please i need your help
Nov 2, 2013 at 6:05am UTC
welcome, I wana make a menu driven calculator but when I start debug there is error "1>c:\users\toshiba\documents\visual studio 2010\projects\sheet 6\sheet 6\sheet 6.cpp(44): fatal error C1075: end of file found before the left brace '{' at 'c:\users\toshiba\documents\visual studio 2010\projects\sheet 6\sheet 6\sheet 6.cpp(5)' was matched
" I don't know where is the problem please help me I am new programmer
thank you
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#include<iostream>
using namespace std;
int main()
{
enum opreator {addiotion,subtraction,muliplication,divition,power,exist};
int choses;
int x,y;
cout<<"a)addiotion\n" ;
cout<<"b)subtraction\n" ;
cout<<"c)muliplication\n" ;
cout<<"d)divition\n" ;
cout<<"e)power\n" ;
cout<<"f)exist" ;
do {
cout<<"choses an opreator" ;
cin>>choses;
cout<<"plese enter 2 numbers" ;
cin>>x;
cin>>y;
switch (choses)
{
case 'a' :cout<<"the result is= " <<x+y<<endl;
case 'b' :cout<<"the result is= " <<x-y<<endl;
case 'c' :cout<<"the result is= " <<x*y<<endl;
case 'd' :cout<<"the result is= " <<x/y<<endl;
case 'e' :cout<<"the result is= " <<x*(y)<<endl;
case 'f' :cout<<"end of calcltor" <<endl;
}while (choses!=false );
system("pause" );
return 0;
}
Nov 2, 2013 at 6:21am UTC
I solved but still have another problem when I say enter place 2 number cant enter 2 number !!!
Nov 2, 2013 at 6:55am UTC
1. You are missing a bracket "}" on the switch(choses). Compiler should complain.
2. You probably want a break on each case statement.
So change each:
case 'a' :cout<<"the result is= " <<x+y<<endl;
to:
case 'a' :cout<<"the result is= " <<x+y<<endl; break ;
refer to the switch section of
http://www.cplusplus.com/doc/tutorial/control/
Nov 2, 2013 at 7:57am UTC
thank u so much ^^
Topic archived. No new replies allowed.