I'm relearning C++ for the first time in a few years. I need some help. I'm using Microsoft Visual C++ 2008.
I'm getting the error messages
1 2
>c:\users\home\documents\visual studio 2008\projects\secondproject\secondproject\main.cpp(59) : error C2047: illegal default
1>c:\users\home\documents\visual studio 2008\projects\secondproject\secondproject\main.cpp(72) : fatal error C1075: end of file found before the left brace '{' at 'c:\users\home\documents\visual studio 2008\projects\secondproject\secondproject\main.cpp(6)' was matched
#include <iostream>
usingnamespace std;
int main(void)
{
system("TITLE Calculator");
system("COLOR 2");
system("pause");
char cChar;
double dfirstnumber;
double dsecondnumber;
char cDoagain;
do
{
system("CLS");
cout << "Please enter the first number you would like to use: "
<< endl;
cin >> dfirstnumber;
cout << "Please enter the desired operation"
<< endl
<< "+,-,* and / are acceptable operations";
cin >> cChar;
cout << "Please enter the second number you would like to use: "
<< endl;
cin >> dsecondnumber;
switch (cChar)
{
case'+' :
cout << "The result is: " << (dfirstnumber + dsecondnumber)
<< endl;
break;
case'-' :
cout << "The result is: " << (dfirstnumber - dsecondnumber)
<< endl;
break;
case'*' :
cout << "The result is: " << (dfirstnumber * dsecondnumber)
<< endl;
break;
case'/' :
if(dsecondnumber == 0)
{ cout << "That is an invalid operation" <<endl;
}
else
{
cout << "The result is: " << (dfirstnumber / dsecondnumber)
<< endl;
break;
}
}
cout << "Would you like to try again? Y/N" <<endl;
cin >> cDoagain;
while (cDoagain == 'Y' || cDoagain == 'y');
system ("PAUSE");
return 0;
}
I've tried matching brackets, but I only get more error messages when I have an equal amount.
Also, I don't know why the default is illegal. I've tried for hours to fix this. Can anyone help me?
THANK YOU ALL!!! All comments were helpful (from formatting to execution). I'm still in the stage where I need to determine what brackets go where...it's been a while since I've done this.