hai
just made this code and i look through it many time.. i cant figure out why it isint woking.. any suggestions ?
#include<iostream>
using namespace std;
int main();
{
system ("TITLE calc");
system ("COLOR 5");
char cChar;
double dfistnumber;
double dsecondnumber;
char cDoagain;
do
{
system ("CLS");
cout << "please enter 1st number that you would like to use" << endl;
cin >> dfirstnubmer;
cout << "please enter the operation you would like to complete" << endl
<< " (+,-,* or /)" << endl;
cin >> cChar;
cout << "please enter the 2n 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 '/':
if (dsecondnumber == 0){
cout << "nice try, but no" << endl; }
if (dfirstnumber == 0){
cout << "nice try, but no" << endl; }
else{
cout << "the answer is: " << dfirstnumber << " / "
<< dsecondnumber << " - " << (dfirstnumber / dsecondnumber << endl;
}
default:
cout << "that is an invalid operation, tard" << endl;
break;
}
cout << "wana try again ? (y/n)" << endl;
cin >> cDoagain;
} while (cDoagain == 'Y' || cDoagain == 'y');
system ("pause");
return 0;
}
i would appreciate any kind of help..