fork(1) download
  1. //Xinnuo Wang CS1A chapter 2 , P.81, #1
  2. //
  3. /*******************************************************************************
  4. *
  5. * Sum of Two Numbers
  6. *-------------------------------------------------------------------------------
  7. * This program stores the integers 62 and 99 in variables, and stores the sum of
  8. * these two in a variable named total.
  9. *
  10. * computation is based on the formula:
  11. * total = numb1+ numb2
  12. *-------------------------------------------------------------------------------
  13. * INPUT
  14. * numb1 : stores the first number
  15. * numb2 : stores the second number
  16. * OUTPUT
  17. * total : numb1+ numb2
  18. *
  19. *******************************************************************************/
  20. #include <iostream>
  21. using namespace std;
  22.  
  23. int main()
  24. {
  25. int numb1; //INPUT - 62 stores in numb1
  26. int numb2; //INPUT - 99 stores in numb2
  27. int total; //OUTPUT - sum of two numbers
  28. //
  29. // Initialize Program Variables
  30. numb1 = 62;
  31. numb2 = 99;
  32. //
  33. // Compute the Sum of the Two Numbers
  34. total = numb1+ numb2;
  35. //
  36. // Output Result
  37. cout << "The sum of 62 and 99 is : " << total << endl;
  38. return 0;
  39. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
The sum of 62 and 99 is : 161