Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <string>
- using namespace std;
- void mainfunc();
- void retry();
- void retry()
- {
- int y;
- while(1)
- {
- cin >> y;
- if (strncmp(x,y,z) == 0);
- }
- {
- mainfunc();
- }
- else return;
- }
- }
- void mainfunc()
- { int x;
- int a;
- string name;
- srand((unsigned int)time(NULL));
- a = rand()%10+1;
- cout << "Enter your name, player! \n";
- cin >> name;
- cout << "\n Welcome, ";
- cout << name;
- cout << " \n";
- cout << " \n";
- cout << "Guess the number between 1 and 10! It changes every time!: ";
- cin >> x;
- if (x>a){ cout << "The number was lower \n"; cout << "YOU FAIL!, "; cout << name;
- cout << " \n";
- cout << " \n";}
- if (x<a){ cout << "The number was higher \n";
- cout << "YOU FAIL!, "; cout << name;
- cout << " \n";
- cout << " \n";}
- if (x==a){ cout << "WINNER IS YOU \n";}
- cout << " \n";
- }
- int main ()
- {
- mainfunc();
- cout << "Hit the Y key then ENTER to close the program, otherwise, press just press ENTER. \n";
- retry();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement