当前位置: 首页>>代码示例>>C++>>正文


C++ FloatToStr函数代码示例

本文整理汇总了C++中FloatToStr函数的典型用法代码示例。如果您正苦于以下问题:C++ FloatToStr函数的具体用法?C++ FloatToStr怎么用?C++ FloatToStr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FloatToStr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BSlider

TSliderComponent::TSliderComponent(const char *AComponentName, const char *AClassName, BRect AFrame, TComponent *AFatherComponent):
BSlider(AFrame,AComponentName,AComponentName,NULL,0,100),TComponentKindaView(AComponentName,AClassName,this)
{
	float largeur,hauteur;

	FParent = AFatherComponent;
	FCodeGenerator = new TSliderCodeGenerator(this,true);
	FPropertyList->AddProperty(PROP_NAME,AComponentName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_CLASSNAME,AClassName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_LABEL,AComponentName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);

	FPropertyList->AddProperty(PROP_MIN,"0",PROP_TYPE_FLOAT,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_MAX,"100",PROP_TYPE_FLOAT,false,true,"",PROP_GENERAL_GROUP);

	FPropertyList->AddProperty(PROP_THUMB,"B_BLOCK_THUMB",PROP_TYPE_FLOAT,true,false,
								"B_BLOCK_THUMB;B_TRIANGLE_THUMB",
								PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_MESSAGE,"NULL",PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);

	FPropertyList->AddProperty(PROP_RESIZING_MODE,"B_FOLLOW_LEFT | B_FOLLOW_TOP",PROP_TYPE_FLOAT,true,false,
								"B_FOLLOW_LEFT;B_FOLLOW_RIGHT;B_FOLLOW_LEFT_RIGHT;B_FOLLOW_H_CENTER;B_FOLLOW_TOP;B_FOLLOW_BOTTOM;B_FOLLOW_TOP_BOTTOM;B_FOLLOW_V_CENTER;B_FOLLOW_ALL_SIDES;B_FOLLOW_NONE",
								PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_FLAGS,"B_NAVIGABLE | B_WILL_DRAW",PROP_TYPE_FLOAT,true,false,
								"B_WILL_DRAW;B_PULSE_NEEDED;B_FRAME_EVENTS;B_FULL_UPDATE_ON_RESIZE;B_NAVIGABLE;B_NAVIGABLE_JUMP;B_SUBPIXEL_PRECISE",
								PROP_POSITION_GROUP);

	GetPreferredSize(&largeur,&hauteur);
	ResizeTo(largeur,hauteur);
	AFrame = Frame();	
	FPropertyList->AddProperty(PROP_TOP,FloatToStr(AFrame.top),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_LEFT,FloatToStr(AFrame.left),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_RIGHT,FloatToStr(AFrame.right),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_BOTTOM,FloatToStr(AFrame.bottom),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);

	FHandler = this; // on fait pointer le FHandler interne du TCOmponent dont on a besoin dans TComponentItem.
	FElement = this;
//	Show(); 
}
开发者ID:HaikuArchives,项目名称:BeBuilder,代码行数:38,代码来源:SliderComponent.cpp

示例2: switch

std::string evalute::evalute_b2Body(Watch* watch)
{
    std::string name = watch->MemberName;
    std::string result = "";
    b2Body* body = boost::get<b2Body*>(watch->Object);

    if( name == "Type")
    {
        b2BodyType type = body->GetType();
        switch(type)
        {
            case b2_staticBody: result = "StaticBody"; break;
            case b2_dynamicBody: result = "DynamicBody"; break;
            case b2_kinematicBody: result = "KinematicBody"; break;
            default: result = "Unknown type";
        }
    }
    else if(name == "Position") result = VectorToStr(body->GetPosition());
    else if(name == "Angle") result = FloatToStr(body->GetAngle());
    else if(name == "WorldCenter") result = VectorToStr(body->GetWorldCenter());
    else if(name == "LocalCenter") result = VectorToStr(body->GetLocalCenter());
    else if(name == "LinearVelocity") result = VectorToStr(body->GetLinearVelocity());
    else if(name == "AngularVelocity") result = FloatToStr(body->GetAngularVelocity());
    else if(name == "Inertia") result = FloatToStr(body->GetInertia());
    else if(name == "LinearDamping") result = FloatToStr(body->GetLinearDamping());
    else if(name == "AngularDamping")result = FloatToStr(body->GetAngularDamping());
    else if(name == "Bullet") result = BoolToStr(body->IsBullet());
    else if(name == "SleepingAllowed") result = BoolToStr(body->IsSleepingAllowed());
    else if(name == "Awake") result = BoolToStr(body->IsAwake());
    else if(name == "Active") result = BoolToStr(body->IsActive());
    else if(name == "FixedRotation") result = BoolToStr(body->IsFixedRotation());
    bool mass = false;
    std::string massValuePrefix = "", massCenterPrefix = "", massRotationInertiaPrefix = "";
    b2MassData massData;
    body->GetMassData(&massData);
    if( name == "Mass")
    {
        mass = true;
        result = "{ ";
        massValuePrefix = "Value = ";
        massCenterPrefix = ", Center = ";
        massRotationInertiaPrefix = ", RotationInertia = ";
    }
    if( name == "Mass.Value" || mass) result += massValuePrefix + FloatToStr(massData.mass);
    if( name == "Mass.Center" || mass) result += massCenterPrefix + VectorToStr(massData.center);
    if( name == "Mass.RotationInertia" || mass)
        result += massRotationInertiaPrefix + FloatToStr(massData.I);
    if(mass) result += " }";

    if(result == "") result = "Can't evalute";

    return result;
}
开发者ID:Phosfor,项目名称:Themisto,代码行数:53,代码来源:EvaluteFunctions.cpp

示例3: StrToFloatDef

void __fastcall TfrmPropVisor::DownClickDbl(TObject *Sender)
{
  const long double inc = 0.01;
  long double value;
  try{
    value = StrToFloatDef(((TEdit*)((TCSpinButton*)Sender)->FocusControl)->Text, 1);
  }catch(...){
    return;}
  if( (value - inc) > 0.0 )
    value -= inc;
  else
    value = 1;
  ((TEdit*)((TCSpinButton*)Sender)->FocusControl)->Text = FloatToStr(value);
}
开发者ID:clubdesarrolladores,项目名称:maxmath,代码行数:14,代码来源:fPropVisor.cpp

示例4: StrToIntDef

void __fastcall TfrmPropVisor::UpClickInt(TObject *Sender)
{
  const int inc = 1;
  int value;
  try{
    value = StrToIntDef(((TEdit*)((TCSpinButton*)Sender)->FocusControl)->Text, 1);
  }catch(...){
    return;}
  if( (value + inc) <= ((TEdit*)((TCSpinButton*)Sender)->FocusControl)->Tag )
    value += inc;
  else
    value = ((TEdit*)((TCSpinButton*)Sender)->FocusControl)->Tag;
  ((TEdit*)((TCSpinButton*)Sender)->FocusControl)->Text = FloatToStr(value);
}
开发者ID:clubdesarrolladores,项目名称:maxmath,代码行数:14,代码来源:fPropVisor.cpp

示例5: GlobalMemoryStatus

//---------------------------------------------------------------------------
void __fastcall TfrmAbout::FormActivate(TObject *Sender)
{
 MEMORYSTATUS MS;

  GlobalMemoryStatus(&MS);

  PhysMem->Caption  = "Всего физической памяти : "      + FormatFloat("#,###' KB'", MS.dwTotalPhys / 1024.0);
  FreeRes->Caption  = "Используется в данный момент : " + IntToStr(MS.dwMemoryLoad) + " %";
  CpuLabel->Caption = "Частота процессора : ";

  CpuLabel->Caption = CpuLabel->Caption + FloatToStr(int((GetCPUSpeed() * 0.9989544010)*10.0)/10.0) + " МГц";

  //DecimalSeparator = '.';
}
开发者ID:Medcheg,项目名称:sources_old,代码行数:15,代码来源:Unit_About.cpp

示例6: StrToFloat

void __fastcall TForm1::Button2Click(TObject *Sender)
{
double a = StrToFloat(Edit3->Text);
double b = StrToFloat(Edit4->Text);
double c = StrToFloat(Edit5->Text);
z = calculate(1, 2)+1/2.;
z = f() + fabs(pow(x - sin(y),1/3.));
z = fabs(pow(y+9/5.+f(1, 2),1/3.));
z = func(a(1/2.,1/2.),3);
z=mas[i+2]+1/2.;
double ans = arifm((a + b) / (a - c * b), b * b - 2 * a * c, 3 * pow(c, a - b)) -
             arifm((c + a) / (a * b), sqrt(b) / pow(a, 1. / 3), pow(a, b + 1. / c));
ShowMessage(FloatToStr(ans));
}
开发者ID:File5,项目名称:Auto_diagram,代码行数:14,代码来源:file4.cpp

示例7: fopen

void __fastcall TSharpnessForm1::btn_sp_SaveClick(TObject *Sender)
{
        if(!SaveDialog1->Execute())
                return;
        String Fpath = SaveDialog1->FileName;
        FILE* fptr = fopen (Fpath.c_str(),"w");

        AnsiString str[5];
        str[0] = "TEXT_DET";
        str[1] = "HORZ_THR";
        str[2] = "VERT_THR";
        str[3] = "EDGE_THR";
        str[4] = "GLT_STR";     //hardwre gain

        AnsiString input_str[5];
        for(int i = 0; i <= 3; i++)
                input_str[i] = "0";
        input_str[4] = "1";

        for(int i = 0; i < OSP->SPChkBox_Nbr; i++){
                if(SameText(ChkB[i]->Addr.Name(),str[0])){
                        input_str[0] = (ChkB[i]->Chkb->Checked?"1":"0");
                        break;
                }
        }
        for(int j = 0; j <= 3; j++)
                for(int i = 0; i < OSP->SPScrollBar_Nbr; i++){
                        if(SameText(ScrlB[i]->Addr.Name(),str[j])){
                                input_str[j] = ScrlB[i]->ScrlB->Position;
                                break;
                        }
                }
       for(int i = 0; i < OSP->SPScrollBar_Nbr; i++){
                if(SameText(ScrlB[i]->Addr.Name(),str[4])){
                                float val = (float)ScrlB[i]->ScrlB->Position*4;
                                input_str[4] = FloatToStr(val);
                                break;
                }
       }
        float input_str5 = StrToFloat(sb_softgain->Position)/10;

        fprintf(fptr,"%s\t%s\t%s\t%s\t%s\t%f\n",input_str[0],input_str[1],input_str[2],
        input_str[3],input_str[4],input_str5);

        for(int i = 0; i < 32; i++){
                fprintf(fptr,"%d\n", SP_lut[i]);
        }
        fclose(fptr);
}
开发者ID:beaver999,项目名称:mygoodjob,代码行数:49,代码来源:Sharpness1.cpp

示例8: get_matr

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  double matrix[8][8]={
	{0,1,0,0,1,0,1,0},
	{1,0,1,0,0,0,0,0},
	{0,1,0,1,0,0,1,0},
	{0,0,1,0,0,0,1,1},
	{1,0,0,0,0,1,0,0},
	{0,0,0,0,1,0,0,0},
	{1,0,1,1,0,0,0,1},
	{0,0,0,1,0,0,1,0}
	};
get_matr (matrix);
Edit1->Text =FloatToStr(det (matrix));
}
开发者ID:mushrooom,项目名称:newrep,代码行数:15,代码来源:Unit1.cpp

示例9: FloatToStr

moText
moGLMatrixf::ToJSON() const {
  moText JSON = "[";
  moText comma="",nline="";
  for(int j=0;j<4; j++) {
    JSON+= nline;
    for(int i=0;i<4; i++) {
      JSON+= comma + FloatToStr( (*this)[j][i] );
      comma=",";
    }
    nline="\n";
  }
  JSON+= "]";
  return JSON;
}
开发者ID:moldeo,项目名称:libmoldeo,代码行数:15,代码来源:moGLManager.cpp

示例10: StrToFloat

void __fastcall TframTag::edtCompDevPercentChange(TObject *Sender)
{
	//
	try{
		__r4 percent;
		percent = StrToFloat(edtCompDevPercent->Text);
		if(percent < 0 || percent > 100){
			return;
		}
		__r4 span = _getSpan(&m_Tag);
		m_Tag.s.CompDev = percent * span / 100;
        edtCompDev->Text = FloatToStr(m_Tag.s.CompDev);
	}catch(...){
	}
}
开发者ID:eseawind,项目名称:CNCS_PMC-Conductor,代码行数:15,代码来源:untTagView.cpp

示例11: BTextControl

TTextControlComponent::TTextControlComponent(const char *AComponentName,const char *AClassName, BRect AFrame, TComponent *AFatherComponent):
BTextControl(AFrame,AComponentName,NULL,"Some Text",NULL,B_FOLLOW_LEFT | B_FOLLOW_TOP,B_FRAME_EVENTS | B_WILL_DRAW | B_NAVIGABLE),TComponentKindaView(AComponentName,AClassName,this)
{
	float largeur,hauteur;
	FHandler = this;
	FParent = AFatherComponent;
	FCodeGenerator = new TTextControlCodeGenerator(this,true);
	FPropertyList->AddProperty(PROP_NAME,AComponentName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_CLASSNAME,AClassName,PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	if (Label()==NULL) 
	{
		FPropertyList->AddProperty(PROP_LABEL,"",PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	}
	else
		FPropertyList->AddProperty(PROP_LABEL,Label(),PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);
	FPropertyList->AddProperty(PROP_MESSAGE,"NULL",PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);

	FPropertyList->AddProperty(PROP_RESIZING_MODE,"B_FOLLOW_LEFT | B_FOLLOW_TOP",PROP_TYPE_FLOAT,true,false,
								"B_FOLLOW_LEFT;B_FOLLOW_RIGHT;B_FOLLOW_LEFT_RIGHT;B_FOLLOW_H_CENTER;B_FOLLOW_TOP;B_FOLLOW_BOTTOM;B_FOLLOW_TOP_BOTTOM;B_FOLLOW_V_CENTER;B_FOLLOW_ALL_SIDES;B_FOLLOW_NONE",
								PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_FLAGS,"B_NAVIGABLE | B_WILL_DRAW",PROP_TYPE_FLOAT,true,false,
								"B_WILL_DRAW;B_PULSE_NEEDED;B_FRAME_EVENTS;B_FULL_UPDATE_ON_RESIZE;B_NAVIGABLE;B_NAVIGABLE_JUMP;B_SUBPIXEL_PRECISE",
								PROP_POSITION_GROUP);

	FPropertyList->AddProperty(PROP_TEXT,Text(),PROP_TYPE_STRING,false,true,"",PROP_GENERAL_GROUP);

	GetPreferredSize(&largeur,&hauteur);
	ResizeTo(largeur,hauteur);

	AFrame = Frame();	
	FPropertyList->AddProperty(PROP_TOP,FloatToStr(AFrame.top),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_LEFT,FloatToStr(AFrame.left),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_RIGHT,FloatToStr(AFrame.right),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);
	FPropertyList->AddProperty(PROP_BOTTOM,FloatToStr(AFrame.bottom),PROP_TYPE_FLOAT,false,true,"",PROP_POSITION_GROUP);

}
开发者ID:HaikuArchives,项目名称:BeBuilder,代码行数:36,代码来源:TextControlComponent.cpp

示例12: CalculateSigma

void __fastcall TFormMain::OnAnyTrackBarChange(
      TObject *Sender)
{
  const int sz = TrackBarSize->Position;
  const double angle = 2.0 * M_PI
    * static_cast<double>(TrackBarAngle->Position)
    / static_cast<double>(TrackBarAngle->Max);
  const double wavelength = 16.0
    * static_cast<double>(TrackBarWavelength->Position)
    / static_cast<double>(TrackBarWavelength->Max);
  const double sigma = CalculateSigma(sz/2);
  LabelSize->Caption = "Size: " + IntToStr(sz) + " pixels";
  LabelAngle->Caption = "Angle: " + FloatToStr(angle) + " radians";
  LabelWavelength->Caption = "Wavelength: " + FloatToStr(wavelength) + " pixels";
  LabelSigma->Caption = "Sigma: " + FloatToStr(sigma);

  mFilter = CreateGaborFilter(sz,angle,wavelength,sigma);

  SurfacePlotter p(ImageFilter);
  p.SetSurfaceGrey(mFilter);
  ImageFilter->Refresh();


}
开发者ID:RLED,项目名称:ProjectRichelBilderbeek,代码行数:24,代码来源:UnitFormMain.cpp

示例13: rgb2hsv

void __fastcall THSVFormOrg::Hue_ImgMouseDown(TObject * Sender,
					      TMouseButton Button, TShiftState Shift, int X, int Y)
{
    int color;
    double h, s, v, i, r, g, b;
    color = Hue_Img->Canvas->Pixels[X][Y];

    b = color / 65536;
    g = color / 256 % 256;
    r = color % 256;

    rgb2hsv(r, g, b, &h, &s, &i, &v);
    ed_Hue_Custom->Text = FloatToStr(h);
    Set_6HSV_grid();
}
开发者ID:beaver999,项目名称:mygoodjob,代码行数:15,代码来源:HueSatVal1.cpp

示例14: imprimirValor

void imprimirValor(struct ArgPresentaValor* arg){
  
  byte decimales= getDecimales();
  int Val= getValor(arg); 
	char str[7];
	OutputStream_writeStr(getCartel(arg));
	
	if(arg->val!=NULL) {
	  OutputStream_writeStr(" ");
	  FloatToStr(Val,str,6,decimales);
    OutputStream_writeStr(str);
    OutputStream_writeStr(" ");
	}else
	  OutputStream_writeStr("\n");
}
开发者ID:jonyMarino,项目名称:dhacel-micro-prog-vieja,代码行数:15,代码来源:presentarValor.c

示例15: switch

// ---------------------------------------------------------------------------
void __fastcall TStdDataForm::FilterOnRadioGroupClick(TObject *Sender) {

	FilterOnLabel->Caption = "Records where " +
		FilterOnRadioGroup->Items->Strings[FilterOnRadioGroup->ItemIndex] + " >=";
	switch (FilterOnRadioGroup->ItemIndex) {
	case 0:
		Orders->OnFilterRecord = OrdersFilterOnDate;
		FilterCriteria->Text = DateToStr(FLastDate);
		break;
	case 1:
		Orders->OnFilterRecord = OrdersFilterOnAmount;
		FilterCriteria->Text = FloatToStr(FLastAmount);
		break;
	}
	ActiveControl = FilterCriteria;
}
开发者ID:SkylineNando,项目名称:Delphi,代码行数:17,代码来源:GdsData.cpp


注:本文中的FloatToStr函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。