Advertisement
TheWhiteFang

[C++][4] Basic calculator with user input

Oct 6th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream> //pre-processor directive
  2.  
  3. using namespace std; //std library
  4.  
  5. int main() //it starts with the main 1st
  6. {
  7.     int a; //variable a
  8.     int b; //variable b
  9.  
  10.     int sum;
  11.  
  12.  
  13.     cout << "Enter a number dude~ \n";
  14.     cin >> a; //cin-input stream object >>-stream extraction operator
  15.  
  16.     cout << "enter another number \n";
  17.     cin >> b;
  18.  
  19.     sum = a+ b;
  20.     cout << "the sum of numbers is " << sum << endl;
  21.  
  22.     return 0; //to tell that program ran fine
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement