0 Members and 1 Guest are viewing this topic.
/* rand example: guess the number */#include <iostream>#include <math.h>#include <stdio.h>#include <stdlib.h>#include <time.h>using namespace std;int randomgen(int range, int bottom);int main(){ for(int i=0; i<5;i++) { int num; num = randomgen(5, 1); cout << num << endl; } system("PAUSE");}int randomgen(int range, int bottom){ int iSecret; srand(time(NULL)); iSecret = rand()%range+bottom; return iSecret;}
'Chapter1.exe': Loaded 'E:\Book\Software\Chapter1\Release\Chapter1.exe', Symbols loaded.'Chapter1.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file'Chapter1.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file'Chapter1.exe': Loaded 'C:\Program Files\Alwil Software\Avast5\snxhk.dll', Cannot find or open the PDB file'Chapter1.exe': Loaded 'C:\WINDOWS\system32\msvcp100.dll', Symbols loaded.'Chapter1.exe': Loaded 'C:\WINDOWS\system32\msvcr100.dll', Symbols loaded.'Chapter1.exe': Loaded 'C:\WINDOWS\system32\shimeng.dll', Cannot find or open the PDB file'Chapter1.exe': Unloaded 'C:\WINDOWS\system32\shimeng.dll'The program '[2980] Chapter1.exe: Native' has exited with code 0 (0x0).
cout << num;
cout << num << endl;
cout << num << flush;