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