Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. int main() {
  4.     char a; std::string answer;
  5.     do {
  6.         std::cout << "Write symbol " <<;
  7.         std::cin >> a;
  8.             std::cout << "Continue? (yes or no)";
  9.             std::cin.clear();
  10.             std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
  11.             do {
  12.                 std::getline(std::cin, answer);
  13.             if (answer != "yes" && answer != "no") { std::cout << "You didn't write answer. Try again." << std::endl; }
  14.         } while(answer !="yes" && answer!="no");
  15.     } while (answer !="no");
  16.     std::cout << a << ", " << std::endl;
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement