#include <iostream>
usingnamespace std;
int main()
{
int a;
int x;
int y;
int sum;
int decimal;
LOOP:
cout << "select calculation method" << endl;
cin >> a >> endl;
cin >> x >> endl;
cin >> y >> endl;
if (a=='+'){
cout << "write the firest number" << endl;
cin >> x >> endl;
cout << "write the second nuber" <<endl;
cin >> y >> endl;
sum = x + y;
cout << sum;
}
if (a=='-'){
cout << "spriv in ditt første tall" << endl;
cin >> x >> endl;
cout << "skriv in ditt andre tall" <<endl;
cin >> y >> endl;
sum = x - y;
cout << sum;
}
if (a=='*'){
cout << "spriv in ditt første tall" << endl;
cin >> x >> endl;
cout << "skriv in ditt andre tall" <<endl;
cin >> y >> endl;
sum = x * y;
cout << sum;
}
if (a=='/'){
cout << "spriv in ditt første tall" << endl;
cin >> x >> endl;
cout << "skriv in ditt andre tall" <<endl;
cin >> y >> endl;
sum = x / y;
decimal = x% y;
cout << sum;
cout << "."decimal << endl;
}
goto LOOP;
system ("pause")
return 0;
}
You are trying to take input from the keyboard and store it in endl. This is insane. endl is not something you can store data in.
This: cin >> a >> endl;
should be cin >> a;
I see you are using goto to simulate a proper loop. Please do not. Not even for practice, not even because it's all you know. Since this is an infinite loop, you can use this: