Posted By

ruler501 on 02/22/11


Tagged


Versions (?)

Random code errors


 / Published in: C++
 

Errors '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 '[756] Chapter1.exe: Native' has exited with code 0 (0x0).

  1. /* rand example: guess the number */
  2. #include <cstdlib>
  3. #include <iostream>
  4. #include <math.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <time.h>
  8. using namespace std;
  9.  
  10. int randomgen(int range, int bottom);
  11.  
  12. int main()
  13. {
  14. for(int i=0; i<5;i++)
  15. {
  16. int num;
  17. num = randomgen(5, 1);
  18. cout << num;
  19. }
  20. }
  21.  
  22. int randomgen(int range, int bottom)
  23. {
  24. int iSecret;
  25. srand(time(NULL));
  26. iSecret = rand()%range+bottom;
  27. return iSecret;
  28. }

Report this snippet  

You need to login to post a comment.