hi . i am actually very proud of myself with this program because i didnt know i was able to do it. i only have one error it is.... line 194 expected `}' at end of input
#include <iostream>
usingnamespace std;
class setup{
public:
void title(){
system("TITLE calculator");
system("color 2");
cout << "hello!!!, IM A CALCULATOR... lets get started" << endl << endl;
}
};
int main()
{
setup setapp1;
setapp1.title();
int howmany;
double a;
double b;
double c;
double d;
double e;
char cchar;
char cagain;
cout << "please enter the amount of numbers you want to use: ";
cin >> howmany;
switch (howmany){
case 1:
cout << "invalid number" << endl;
break;
case 2:
do{
cout << "please enter the first number you want to use" << endl;
cin >> a;
cout << "please enter the operation you would like to use" << endl;
cin >> cchar;
cout << "please enter the second number you would like to use" << endl;
cin >> b;
switch (cchar){
case'+':
cout << "the answer is: " << a << " + " << b << " = "
<< (a + b) << endl;
break;
case'-':
cout << "the answer is: " << a << " - " << b << " = "
<< (a - b) << endl;
break;
case'*':
cout << "the answer is: " << a << " * " << b << " = "
<< (a * b) << endl;
break;
case'/':
cout << "the answer is: " << a << " / " << b << " = "
<< (a / b) << endl;
break;
default:
cout << "you cant use that operation";
break;
}
cout << "would you like to start again (y or n)";
cin >> cagain;
}while (cagain == 'y' || cagain == 'Y');
break;
case 3:
do{
cout << "please enter the operation you would like to use" << endl;
cin >> cchar;
cout << "please enter the first number you would like to use" << endl;
cin >> a;
cout << "please enter the second number you would like to use" << endl;
cin >> b;
cout << "please enter the third number you would like to use" << endl;
cin >> c;
switch (cchar){
case'+':
cout << "the answer is: " << a << " + " << b << "+" << c << " = "
<< (a + b + c) << endl;
break;
case'-':
cout << "the answer is: " << a << " - " << b << "-" << c << " = "
<< (a - b - c) << endl;
break;
case'*':
cout << "the answer is: " << a << " * " << b << " * " << c << " = "
<< (a * b * c) << endl;
break;
case'/':
cout << "the answer is: " << a << " / " << b << " / " << c << " = "
<< (a / b / c) << endl;
break;
default:
cout << "you cant use that operation";
break;
}
cout << "would you like to start again (y or n)";
cin >> cagain;
}while (cagain == 'y' || cagain == 'Y');
case 4:
do{
cout << "please enter the operation you would like to use" << endl;
cin >> cchar;
cout << "please enter the first number you would like to use" << endl;
cin >> a;
cout << "please enter the second number you would like to use" << endl;
cin >> b;
cout << "please enter the third number you would like to use" << endl;
cin >> c;
cout << "please enter the forth number you would like to use" << endl;
cin >> d;
switch (cchar){
case'+':
cout << "the answer is: " << a << " + " << b << "+" << c << "+" << d << " = "
<< (a + b + c + d) << endl;
break;
case'-':
cout << "the answer is: " << a << " - " << b << "-" << c << "-" << d << " = "
<< (a - b - c - d) << endl;
break;
case'*':
cout << "the answer is: " << a << " * " << b << " * " << c << " * " << d << " = "
<< (a * b * c * d) << endl;
break;
case'/':
cout << "the answer is: " << a << " / " << b << " / " << c << " / " << d << " = "
<< (a / b / c / d) << endl;
break;
default:
cout << "you cant use that operation";
break;
}
cout << "would you like to start again (y or n)";
cin >> cagain;
}while (cagain == 'y' || cagain == 'Y');
case 5:
do{
cout << "please enter the operation you would like to use" << endl;
cin >> cchar;
cout << "please enter the first number you would like to use" << endl;
cin >> a;
cout << "please enter the second number you would like to use" << endl;
cin >> b;
cout << "please enter the third number you would like to use" << endl;
cin >> c;
cout << "please enter the forth number you would like to use" << endl;
cin >> d;
cout << "please enter the fifth number you would like to use" << endl;
cin >> e;
switch (cchar){
case'+':
cout << "the answer is: " << a << " + " << b << "+" << c << " + " << d << " + " << e << " = "
<< (a + b + c + d + e) << endl;
break;
case'-':
cout << "the answer is: " << a << " - " << b << "-" << c << " - " << d << " - " << e << " = "
<< (a - b - c - d - e) << endl;
break;
case'*':
cout << "the answer is: " << a << " * " << b << " * " << c << " * " << d << " * " << e << " = "
<< (a * b * c * d * e) << endl;
break;
case'/':
cout << "the answer is: " << a << " / " << b << " / " << c << " / " << d << " / " << e << " = "
<< (a / b / c / d / e) << endl;
break;
default:
cout << "you cant use that operation";
break;
}
cout << "would you like to start again (y or n)";
cin >> cagain;
}while (cagain == 'y' || cagain == 'Y');
system("pause");
return 0;
}