fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // These are my varible declarations
  6. int num1, num2, sum, procuct, difference;
  7. string name, fname, mname;
  8.  
  9. // Get names from the user by first prompting the user to enter the name
  10. // then using "cin" to receive it from the keyboard
  11. cout << "Enter first name: ";
  12. cin >> fname;
  13. cout << "Enter middle name: ";
  14. cin >> mname;
  15.  
  16. cout << "Enter number 1: ";
  17. cin >> num1;
  18. cout << "Enter number 2: ";
  19. cin >> num2;
  20.  
  21. // Now I am joining my fname with my middle name
  22. name = fname + " " + mname;
  23.  
  24. sum = num1 + num2;
  25. procuct = num1 * num2;
  26. difference = num1 - sum;
  27.  
  28. // Now I am displaying the output to the screen
  29. cout << "Hello World! My name is " << name << ". ";
  30. cout << "This is my first program. \n\n Yipeee!!!" << endl;
  31.  
  32. cout << "\n\nThe sum of " << num1 << " + " <<num2<< " = " <<sum;
  33. cout << "\n\nThe product of " << num1 << " * " <<num2<< " = " <<procuct;
  34. cout << "\n\nThe difference of " << num1 << " - " <<sum<< " = " <<difference;
  35.  
  36. cout << "\n\n";
  37. system("pause");
  38. }
Success #stdin #stdout #stderr 0s 3480KB
stdin
Standard input is empty
stdout
Enter first name: Enter middle name: Enter number 1: Enter number 2: Hello World! My name is  . This is my first program. 

 Yipeee!!!


The sum of -1215797800 + 134521496 = -1081276304

The product of -1215797800 * 134521496 = -1597036480

The difference of -1215797800 - -1081276304 = -134521496

stderr
sh: pause: not found