do
{
cout<< "Please enter the first number that you would like to use"
<<endl;
cin>> dfirstnumber;
cout<< "Please enter the operation that you would like to complete"
<<" (+,-,* or /)" << endl;
cin>> cChar;
cout<< "Please enter the second number you would like to use"
<< endl;
switch (cChar)
{
case '+':
cout << "The answer is: " << dfirstnumber << " + " <<
dsecondnumber << " = " << (dfirstnumber + dsecondnumber)
<< endl;
break;
case '-':
cout << "The answer is: " << dfirstnumber << " - " <<
dsecondnumber << " = " << (dfirstnumber - dsecondnumber)
<< endl;
break;
case '*':
cout << "The answer is: " << dfirstnumber << " * " <<
dsecondnumber << " = " << (dfirstnumber * dsecondnumber)
<< endl;
break;
case 'x':
cout << "The answer is: " << dfirstnumber << " x " <<
dsecondnumber << " = " << (dfirstnumber * dsecondnumber)
<< endl;
break;
case "/":
if(dsecondnumber == 0) {
cout << "That is an invalid operation" << endl;
}else{
cout << "The answer is: " << dfirstnumber << " / " <<
dsecondnumber << " = " << (dfirstnumber /dsecondnumber)
<< endl;
}
break;
default:
cout << "That is an invalid operation" <<endl;
break;
}
cout <<"would you like to start again? (y or n)"<<endl;
cin>> cDoagain;
while (cDoagain == 'Y' || cDoagain == 'y');
return 0 ;
And here are my errors:
recipe for target `src/Test.o'
make: *** [src/Test.o] Error 1
expected primary-expression at end of input
expected 'while' at end of input
expected '}' at end of input
expected '(' at end of input
expected ';' at end of input
case label does not reduce to an integer constant (line 48)