fork download
  1. //adhira b cs1a ch 2 hw
  2. /***********************************************************************
  3.  * calculate sum of two numbers
  4.  * __________________________________________________
  5.  * name two variables and assign input numbers to each, then
  6. * calculate the sum
  7.  * __________________________________________________
  8.  * OUT
  9. *total
  10. ***********************************************************************/
  11. #include <iostream>
  12. using namespace std;
  13.  
  14. int main() {
  15. int item_1;
  16. int item_2;
  17. int total;
  18.  
  19. cout << "what is the value of item one?" << endl;
  20. cin>>item_1;
  21.  
  22. cout<<"what is the value of item two?" << endl;
  23. cin>> item_2;
  24.  
  25. total = item_1 + item_2; //find sum
  26.  
  27. cout << " " << endl;
  28.  
  29. cout << "total: " <<total<<endl;
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5316KB
stdin
62
99
stdout
what is the value of item one?
what is the value of item two?
 
total: 161