| | |
How to put a int name into a messagebox
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Apr 2009
Posts: 20
Reputation:
Solved Threads: 0
ok so i wanted to make a number randomiser like so:
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <windows.h> using namespace std; int main() { srand((unsigned)time(0)); int random_integer; for(int index=0; index<20; index++){ random_integer = (rand()%60)+1; MessageBox(NULL, "Random Number: ", "Bingo",MB_OK | MB_ICONINFORMATION); Sleep(2000); } return 0; } I want to put the randon_integer result into the message box in front of "Random Number: " can anyone help me on this ? thanks
Write it to a string with sprintf (or wsprintf):
C++ Syntax (Toggle Plain Text)
sprintf( buf, "Random Number: %d", random_integer ); MessageBox( 0, buf, ... )
•
•
Join Date: Apr 2009
Posts: 20
Reputation:
Solved Threads: 0
•
•
•
•
Write it to a string with sprintf (or wsprintf):
C++ Syntax (Toggle Plain Text)
sprintf( buf, "Random Number: %d", random_integer ); MessageBox( 0, buf, ... )
![]() |
Similar Threads
- Create buttons at runtime (C#)
- ifstream ReadFile (C++)
- how to print out an array in a message box (Java)
- where should I put my AtlWaitWithMessageLoop(hThread); ?????? (C++)
- Text printing is giving me trouble (C#)
- XML save settings (C#)
- I need help with window based c# program (C#)
- MS Visual++ 6.0 - Error C2146, C2501 ... (C++)
- Need help with DirectX code (C)
Other Threads in the C++ Forum
- Previous Thread: How to call in the external function?
- Next Thread: How to use getline
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





