Advertisement
Guest User

З

a guest
May 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. //
  2. // main.cpp
  3. // FavouriteProject
  4. //
  5. // Created by Анастасия Калугина on 23/03/2019.
  6. // Copyright © 2019 Анастасия Калугина. All rights reserved.
  7. //
  8. #include <iostream>
  9. #include <string>
  10. #include<cstdlib>
  11. #include<ctime>
  12.  
  13. using namespace std;
  14.  
  15. bool isMyNumber(int myNumber,int x) {
  16.  
  17. if (x > myNumber) {
  18. cout << "Нет, оно меньше" << endl;
  19. return false;
  20. }
  21.  
  22. if (x < myNumber) {
  23. cout << "Нет, оно больше"<<endl;
  24. return false;
  25. }
  26.  
  27. cout << "Ты справился(-ась)!" << endl;
  28. return true;
  29. }
  30.  
  31.  
  32. int main(){
  33. //srand(time(0));
  34. int x;
  35. int number=rand()%100+1;
  36. cin >> x;
  37. int k=0;
  38. while (isMyNumber(number,x) == false) {
  39. k++;
  40. cin >> x;
  41. }
  42. cout<<k;
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement