fork download
  1. #include <iostream>
  2.  
  3. int main()
  4. {
  5. double input;
  6. std::cout << "What is two plus two?" << std::endl;
  7. std::cin >> input;
  8. if (input == 4) std::cout << "Correct, sir." << std::endl;
  9. else std::cout << "Nope, you're bad at math." << std::endl;
  10. }
Success #stdin #stdout 0s 2988KB
stdin
4
stdout
What is two plus two?
Correct, sir.