ok so i wanted to make a number randomiser like so:

#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):

sprintf( buf, "Random Number: %d", random_integer );
MessageBox( 0, buf, ... )

Write it to a string with sprintf (or wsprintf):

sprintf( buf, "Random Number: %d", random_integer );
MessageBox( 0, buf, ... )

ok thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.