I am making a scientific calculator as an assignment in my class. I am using switch case for all the operators like +-*/ , and I am calling them with a single keyword like '+' for addition and so on. The problem is that when i try to use more than one word in case statement for mathematical function like Tan, Cos or sin , The program does not calculate anything. I am using char for the cases in switch statement.
here's da snippet of what i am doing (i am showing some part of the program, consider i have already declared all the variables) :
char ch[10];
switch(ch)
{case 's': // i want to use 'sin' here but the program does not calculate anything after i do so!
trig= sin(fno*pi/180);
cout<<endl<<"Sin("<<fno<<") = "<<trig<<endl<<endl;
break;
}
Any help will be appreciated... thanks...