fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <time.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int number; //user's choice
  10. int i; //random number
  11. int answer;
  12. double rate;
  13. int playagain;
  14. do {
  15. srand (time(NULL));
  16. i = rand () %1000+1; //sets up randnumgen from 1-1000
  17. do {
  18. cout<< "Guess the secret number between 1 and 1000: ";
  19. scanf ("%d", &number);
  20. if (i>number)
  21. cout<<"The secret number is higher\n";
  22. else if (i<number)
  23. cout<<"The secret number is lower\n";
  24. } while (i!=number); //prompts the user to input a number until the correct number is choosen
  25.  
  26. cout<<"YOU WIN!!!\n";
  27.  
  28. do {
  29. cout<<"Did you enjoy the game? (1 for Yes or 2 for No)\n";
  30. cin>> answer;
  31. if (answer==1)
  32. cout<<"Thank you! Please play again! Enter a rating (1-10)\n";
  33. else if (answer==2)
  34. cout<<"Well, FUCK YOU!!!!!!! Try again\n";
  35. else
  36. cout<<"That wasn't an option, fag. Try again\n";
  37. } while (answer!=1); //prompts user about whether or not they like the game until they say yes
  38.  
  39. do {
  40. cin>> rate;
  41.  
  42. if (rate<9)
  43. cout<<"You suck, asshole! Enter a real rating, bitch.\n";
  44. else
  45. cout<<"Thanks for rating!"<<endl;
  46. } while (rate<9); //prompts user to rate game until they say 9 or higher LOLZ--do it for them
  47.  
  48. do {
  49. cout<<"Do you want to play again? (1 for Yes or 2 for No)\n";
  50. cin>> playagain;
  51. if (playagain==1)
  52. cout<<"Okay! Have fun!\n";
  53. else if (playagain==2)
  54. cout<<"Okay! Thanks for playing!\n";
  55. else
  56. cout<<"That wasn't an option. Please press 1 for Yes or 2 for No.\n";
  57. } while (playagain>2);
  58.  
  59. } while (playagain==1);
  60.  
  61. return 0;
  62. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:15: error: ‘srand’ was not declared in this scope
prog.cpp:16: error: ‘rand’ was not declared in this scope
prog.cpp:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result
stdout
Standard output is empty