Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String & Variable Concatenation problem

Status
Not open for further replies.

bd02eagle

Programmer
Jul 7, 2006
15
0
0
US
Here's a C++ statement:
double B1 = 2.0;
cout << "B1 = " << B1 << "lbs." << endl;

Whats the equivalent code in Borland C++ Builder?
I know

RichEdit1->Lines->Append("B1");

does the first part but Im not familiar with string and variable concatenation.
Thanks
 
Try:

RichEdit1->Lines->Add("B1 =" + String(B1) + " lbs.");
 
Alternately, you can try:
Code:
String B1Str = "B1 = " + FloatToStr(B1) + " lbs";
// or if you wanted the resulting string formated
String B2Str = "B1 = " + FloatToStrF(B1, ffFixed, 10, 1) // Fixed decimal with 10 digits total, 1 decimal place.
RichEdit1->Lines->Add(B1); // non formated
RichEdit1->Lines->Add(B2); // formated

James P. Cottingham
-----------------------------------------
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top