Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cstdlib>
- #include <ctime>
- #if defined(_WIN32) || defined(_WIN64)
- #pragma execution_character_set("utf-8")
- #include<Windows.h>
- const auto _dummy_ = []()
- {
- SetConsoleCP(65001);
- SetConsoleOutputCP(65001);
- return 0;
- }();
- #endif
- using namespace std;
- int main()
- {
- string phrase = "That who nothing to lose, is always has chanse to win. ";
- string phraseCopy = phrase;
- cout << "In this game you need guess end enter phrase without some words" << endl;
- cout << "Enter how many words you need to destroy!(no more " << phrase.size() - 1<<")"<< endl;
- unsigned int quantity;
- cin >> quantity;
- for (; quantity > 0; --quantity)
- {
- int randDestroy = (rand() % phrase.size()) + 1;
- phrase[randDestroy] = 'X';
- }
- cout << phrase << endl;
- cout << "Now, enter what phrase coding in here" << endl;
- string phraseUser;
- do
- {
- getline(cin, phraseUser);
- if (phraseUser != phraseCopy)
- {
- cout << "Wrong, try againk" << endl;
- }
- } while (phraseUser != phraseCopy);
- cout << "Fine good work!!!" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment