sh: main: command not found



Hello All,
I just started a class on c++ and it is all totally new to me. I am using the web site -tutorialspoint.com/compile_cpp_online.php to try and run this simple program and all I get is-
sh: main: command not found
sh: 4.3$
We had problems with this site in lab but some folks said it worked on their pc's so I gave it a try. I really can't find the error but I'm really a neophyte with computers, I still hunt and peck!! I would really appreciate any insight. Thank you in advance, please don't be to tough on me, I'm sensitive ;)
 
  Put the code you need help with here.

#include <iostream>

using namespace std;

int main ()

{
//define variables

int x1, x2, prod, diff, val;

//ask for user input
cout << "Enter a value for x1:";

cin >> x1;

cout << "Enter a value for x2:";

cin >> x2;

//out put the results of operations.

prod = x1 * x2;
cout << "The product of " << X1 << "*" << x2 << "is " << prod <<endl;

diff = |x1-x2|;
cout << "The difference between " << x1 << " and " << x2 << " is " << diff << endl;

val = (x1 + 2)*(x2 + 3);
cout << "The value of (" << x1 << " + 2)(" << x2 << " + 3) is:" << val << endl;



return 0;
}

Last edited on
closed account (48T7M4Gy)
cout << "The product of " << x1 << "*" << x2 << "is " << prod <<endl;
x1 not X1

diff = x1 - x2 ;
There are a number of ways to get the absolute difference, '|' is not one of them in C++ :)
Topic archived. No new replies allowed.