I have another issue with a sample excercise. Here is my code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
string s;
double op1, op2, sum, diff, product, div;
sum = op1 + op2;
diff = op1 - op2;
product = op1 * op2;
div = op1 / op2;
cout << "Enter an operation and two operands: ";
while (cin >> s >> op1 >> op2){
if (s=='+')
cout << "Sum is equal to " << sum << "\n";
if (s=='-')
cout << "Diff is equal to " << diff << "\n";
if (s=='*')
cout << "Product is equal to " << product << "\n";
if (s=='/')
cout << "Div is equal to " << div << "\n;
Here is the error I'm getting : could not deduce template argument for 'const std::vector<_Ty,_Alloc> &' from 'std::string'
I would change your string variable to a char. I believe that a statement like string == char is illegal. It looks like you are doing your calculations, before you input the data you are doing your calculation on. You need to reverse that. Also you are missing a double quotation mark at the end of line 16. I would change the \n to an endl;