fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string GetString()
  6. {
  7. string s;
  8. cin >> s;
  9. return s;
  10. }
  11.  
  12. int GetInt()
  13. {
  14. int i;
  15. cin >> i;
  16. return i;
  17. }
  18.  
  19. int main()
  20. {
  21. printf("Are you hungry?\n");
  22. string hungry = GetString();
  23.  
  24. if (hungry == "yes")
  25. {
  26. printf("What is the temperature?\n");
  27. int temperature = GetInt();
  28.  
  29. if (temperature >= 27)
  30. {
  31. printf("Eat icecream!\n");
  32. }
  33. }
  34.  
  35. return 0;
  36. }
Success #stdin #stdout 0s 3276KB
stdin
yes
35
stdout
Are you hungry?
What is the temperature?
Eat icecream!