Okay, so I've looked around and I still do not quite understand why I am getting this error. My code is included below. I had some older code that was working just fine. Then I decided to make it so you could perform more than one calculation per opening of the application. After fixing several other errors, this one popped up. This one had popped up after I realized I needed ' ' around the y.
#include "stdafx.h"
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
int x;
int y;
int result;
char z;
char a = 'y';
char st();
{
cout << ("Do another calculation?: y/n");
cin >> a;
if (a = 'n')
{
system("PAUSE");
return 0;
}
}
while (a = 'y');
{
cout << "Symbol here: " <<endl;
cin >> z;
cout << "Number 1: " <<endl;
cin >> y;
cout << "Number 2: " <<endl;
cin >> x;
if (z == '*')
{
result = x * y;
cout << "Answer:" << result <<endl;
st();
}
else if (z == '/')
{
result = x * y;
cout << "Answer:" << result <<endl;
st();
}
else if (z == '-')
{
result = x / y;
cout << "Answer:" << result <<endl;
st();
}
else if (z == '+')
{
result = x + y;
cout << "Answer:" << result <<endl;
st();
}
else if (z == '%')
{
result = y % x;
cout << "Answer:" << result <<endl;
st();
}
}
}