MWonch
asked on
Converting COUT to MessageBox??
Hi!
I know how to do the following in VC++, but I'm finding it's a little different using Borland's Turbo C++ 4.5 for Windows!
Please take a look at the following code. What I want to do it take the last two COUT lines and place them into a MessageBox.
In VC++, I use CString to declare tempstring (example: CSTRING tempstring). I then initialize tempstring with the MB message (example: "You entered: " + m_LoginName;). How do I get a MessageBox to do this with Borland's little, outdated compiler (I have to use it for school)?
The code:
#include <iostream.h>
int main()
{
int Seconds = 0;
cout << "How much whipped cream is in the can (percentage)? " << flush;
float Balance;
cin >> Balance;
float WhippedCream = Balance * .50;
while (Balance > WhippedCream)
{
++Seconds;
Balance *= .98;
}
cout << "\nIt will take " << Seconds << " seconds to empty half of the ";
cout << "\nremaining whipped cream." << endl;
return 0;
}
Hi!
I know how to do the following in VC++, but I'm finding it's a little different using Borland's Turbo C++ 4.5 for Windows!
Please take a look at the following code. What I want to do it take the last two COUT lines and place them into a MessageBox.
In VC++, I use CString to declare tempstring (example: CSTRING tempstring). I then initialize tempstring with the MB message (example: "You entered: " + m_LoginName;). How do I get a MessageBox to do this with Borland's little, outdated compiler (I have to use it for school)?
The code:
#include <iostream.h>
int main()
{
int Seconds = 0;
cout << "How much whipped cream is in the can (percentage)? " << flush;
float Balance;
cin >> Balance;
float WhippedCream = Balance * .50;
while (Balance > WhippedCream)
{
++Seconds;
Balance *= .98;
}
cout << "\nIt will take " << Seconds << " seconds to empty half of the ";
cout << "\nremaining whipped cream." << endl;
return 0;
}
Thanks!
Mike Wonch
I know how to do the following in VC++, but I'm finding it's a little different using Borland's Turbo C++ 4.5 for Windows!
Please take a look at the following code. What I want to do it take the last two COUT lines and place them into a MessageBox.
In VC++, I use CString to declare tempstring (example: CSTRING tempstring). I then initialize tempstring with the MB message (example: "You entered: " + m_LoginName;). How do I get a MessageBox to do this with Borland's little, outdated compiler (I have to use it for school)?
The code:
#include <iostream.h>
int main()
{
int Seconds = 0;
cout << "How much whipped cream is in the can (percentage)? " << flush;
float Balance;
cin >> Balance;
float WhippedCream = Balance * .50;
while (Balance > WhippedCream)
{
++Seconds;
Balance *= .98;
}
cout << "\nIt will take " << Seconds << " seconds to empty half of the ";
cout << "\nremaining whipped cream." << endl;
return 0;
}
Hi!
I know how to do the following in VC++, but I'm finding it's a little different using Borland's Turbo C++ 4.5 for Windows!
Please take a look at the following code. What I want to do it take the last two COUT lines and place them into a MessageBox.
In VC++, I use CString to declare tempstring (example: CSTRING tempstring). I then initialize tempstring with the MB message (example: "You entered: " + m_LoginName;). How do I get a MessageBox to do this with Borland's little, outdated compiler (I have to use it for school)?
The code:
#include <iostream.h>
int main()
{
int Seconds = 0;
cout << "How much whipped cream is in the can (percentage)? " << flush;
float Balance;
cin >> Balance;
float WhippedCream = Balance * .50;
while (Balance > WhippedCream)
{
++Seconds;
Balance *= .98;
}
cout << "\nIt will take " << Seconds << " seconds to empty half of the ";
cout << "\nremaining whipped cream." << endl;
return 0;
}
Thanks!
Mike Wonch
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.