Hi, I am a big n00b using dev c++. I tried to make a sort of calculator using what I have learnt so far from the tutourials but I get lots of compile errors and have no idea what is going on.
Code:
#include <iostream>
#include <fstream>
using namespace std;
int problem(int x, int y, int z, short operation);
int main()
{
int x;
int y;
int z;
bool q = 0;
short operation;
cout<<"Enter operation. Then x and y.";
for(q = 0);
{
cout<<"1.* \n 2./ \n 3.- \n 4.+";
cin>>operation;
cin>>x>>y;
problem(x, y, z, operation);
cout<<"Quit? [0/1]";
cin>>q;
}
cin.get();
return 0;
}
int problem(int x, int y, int z, short operation)
{
switch (operation)
{
case 1:
x * y = z;
case 2:
x / y = z;
case 3:
x - y = z;
case 4:
x + y = z;
};
return z;
}
These are the compiler errors.
Code:
In function `int main()':
16 expected `;' before ')' token
17 expected primary-expression before '{' token
17 expected `;' before '{' token
17 expected primary-expression before '{' token
17 expected `)' before '{' token
In function `int problem(int, int, int, short int)':
34 non-lvalue in assignment
36 non-lvalue in assignment
38 non-lvalue in assignment
40 non-lvalue in assignment
Can you tell me wat im doing wrong?