fork download
  1. #include <iostream>
  2. int ReadNumber()
  3. {
  4. using namespace std;
  5. cout << "Enter a number: ";
  6. int x;
  7. cin >> x;
  8. return x;
  9. }
  10.  
  11. void WriteAnswer(int x)
  12. {
  13. using namespace std;
  14. cout << "The answer is " << x << endl;
  15. }
  16.  
  17. int main()
  18. {
  19. int x = ReadNumber();
  20. int y = ReadNumber();
  21. WriteAnswer(x+y);
  22. return 0;
  23. }
Success #stdin #stdout 0s 3300KB
stdin
3
5
stdout
Enter a number: Enter a number: The answer is 8