I tried to write a basic calculator program, Visual basic finds 1 error. I cant find it.
Please help. I am kind off new to programming.
#include <iostream>
using namespace std;
int main(void)
{
system("TITLE calculator");
system("COLOR 9");
char cChar;
double dfirstnumber;
double dsecondnumber;
char cDoagain;
do
{
system("CLS");
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;
cin >> dsecondnumber;
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 'x':
cout << "the answer is: " << dfirstnumber << " x " << dsecondnumber << " = " <<
(dfirstnumber * dsecondnumber) << endl;
break;
case '/':
if (dsecondnumber == 0) {
cout << " that is invalid " << 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');
system("PAUSE");
return 0;
}