BrU32

C++ Number Guessing Game Hot Or Cold V1 SRC

Jul 9th, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. using namespace std;
  5.  
  6. int rando, guess;
  7. int count = 1;
  8.  
  9. int main(){
  10. srand (time(0));
  11. rando = 1 + rand()% 100;
  12.  
  13. cout << "Type a number between 1 and 100, hope you get it! " << endl;
  14. cin >> guess;
  15.  
  16. while (guess != rando){
  17. if (guess < rando){
  18. cout << "You guessed very low! Try again: " << endl;
  19. cin >> guess;
  20. }
  21. else if (guess > rando){
  22. cout << "You guessed very high! Try again: " << endl;
  23. cin >> guess;
  24. }
  25. }
  26.  
  27. if (guess = rando){
  28. cout << "You got it correct!" << endl;
  29. }
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment