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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display double with string in MFC

Status
Not open for further replies.

blang0477

Programmer
Feb 20, 2006
1
US
Can anyone tells me how to display a numerical value in Visual C++ MFC Dialog interface?
Like l know MesssageBox("hello") will give a popup window display a string, but it doesn't work with any double or int...

In VBA, I can just say msgbox(1 & " plus " & 2 & " equal to " & 3)
which will show "1 plus 2 equal to 3"

how can I do this in Visual C++?
for example
double a=1.00;
double b=2.00;
double c=3.00;

how can I make MFC display "1.00 plus 2.00 equal to 3.00"
either in a pop up window or edit box would be fine.
 
Heres how you could do it:

Code:
double a=1.00;
double b=2.00;
double c=3.00;
char szData[100];

sprintf(szData,"%f plus %f equal to %f",a,b,c);

AfxMessageBox(szData);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top