Hello everybody,
I'm totally newbie with c++ language.
I'm using Visual C++ 2005 Express Edition.
I like to make a working GUI with my first c++ code.
My question is:
How to insert this code to Windows Forms (GUI) that contain:
1. Press "Button" to randomly generate the number from the code
2. "TextBox" to display the result from generated number.
I hope someone will provide me the full code that i can compile it here.
Here is the code:
#include <cstdlib>
#include <ctime>
#include <iostream>
using std::cout;
int main( ) {
// srand will set a random starting point for rand()
// We use the time as a seed, as it's always changing
srand( ( unsigned )time( 0 ) );
// We generate a random number between 0 and 4013
// 4013 because ( 22423 * 4013 => 89983499 and
// 89983499 + 10016486 => 99999985 - our max value )
int randomKey = rand() % 4013;
// Output the generated key and don't immediately close the command prompt window
cout << "Your random key is: ABC" << ( 10016486 + ( randomKey * 22423 ) ) << "\n";
system( "PAUSE" );
return 0;
}
Tahnks for any suggestion and help.