irmantas_radavicius

Untitled

Feb 19th, 2026
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5. {
  6.     std::string name;
  7.     int ans;
  8.     char response;
  9.     std::cout << "Hello User, Enter your Name.\n ";
  10.     std::cin >> name;
  11.     std::cout << "Hello " << name
  12.               <<". It was nice to know your name!\n";
  13.  
  14.  
  15.     std::cout<<"\nDo you want to solve a math problem?(Y/N)\n";
  16.     std::cin>> response;
  17.     if (response == 'Y')
  18.     {
  19.         std::cout<<"What is 10 + 10?\n";
  20.         std::cin>>ans;
  21.             if (ans == 20)
  22.             {
  23.                 std::cout<<"Fabulous!! \nHave a Wonderful day";
  24.             }
  25.             else
  26.             {
  27.                 std::cout<<"Wrong answer!! \nWork hard, Have a Wonderful day";
  28.             }
  29.     }
  30.     else
  31.     {
  32.         std::cout<<"Okay fine!,Have a Wonderful day";
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment