fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. / This is my header / include section
  7. #include<iostream>
  8. #include<string>
  9.  
  10. using namespace std;
  11.  
  12.  
  13. void main()
  14. {
  15. // These are my varible declarations
  16. int num1, num2, sum, procuct, difference;
  17. string name, fname, mname;
  18.  
  19. // Get names from the user by first prompting the user to enter the name
  20. // then using "cin" to receive it from the keyboard
  21. cout << "Enter first name: ";
  22. cin >> fname;
  23. cout << "Enter middle name: ";
  24. cin >> mname;
  25.  
  26. cout << "Enter number 1: ";
  27. cin >> num1;
  28. cout << "Enter number 2: ";
  29. cin >> num2;
  30.  
  31. // Now I am joining my fname with my middle name
  32. name = fname + " " + mname;
  33.  
  34. sum = num1 + num2;
  35. procuct = num1 * num2;
  36. difference = num1 - sum;
  37.  
  38. // Now I am displaying the output to the screen
  39. cout << "Hello World! My name is " << name << ". ";
  40. cout << "This is my first program. \n\n Yipeee!!!" << endl;
  41.  
  42. cout << "\n\nThe sum of " << num1 << " + " <<num2<< " = " <<sum;
  43. cout << "\n\nThe product of " << num1 << " * " <<num2<< " = " <<procuct;
  44. cout << "\n\nThe difference of " << num1 << " - " <<sum<< " = " <<difference;
  45.  
  46. cout << "\n\n";
  47. system("pause");
  48. }
  49. return 0;
  50. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:6:2: error: expected primary-expression before ‘/’ token
  / This is my header / include section
  ^
prog.cpp:6:4: error: ‘This’ was not declared in this scope
  / This is my header / include section
    ^
prog.cpp:6:9: error: expected ‘;’ before ‘is’
  / This is my header / include section
         ^
prog.cpp:14:1: error: a function-definition is not allowed here before ‘{’ token
 {
 ^
stdout
Standard output is empty