Function in Turbo C lang to Use Operator To Solve

Cebu, Philippines
September 22, 2012 9:55am CST
Hi Please help I have a problem in turbo c. The output should process the two integer by selecting +,-,*, /. Our teacher show us that to solve the two integer that will be done by presing shift plus the character, example when shift + : for addiction, ; shift - : for minus and so fort.
1 response
• Chennai, India
22 Sep 12
I can't understand your question. If you want to use the keyboard to decide the operation, use getch() or getche() function. example: main() { int a=5,b=5; char inkey; fflush(stdin); /* flushes the keyboard buffer */ inkey = getche() /* gets a key from keyboard and shows on screen */ if (inkey == '+') printf("The addition of %d and %d = %d",a,b,a+b); } Similarly, you can use other "if" statements based on the operators. Hope this helps. If your question is different, just make it little clear please.
• Chennai, India
22 Sep 12
Forgot to put a semi-colon at the end of getche(). It should be "inkey = getche();"
• Chennai, India
22 Sep 12
Thanks for the Best Response. Does it mean that you got your problem solved?
• Cebu, Philippines
22 Sep 12
yes, it really works. thank you so much. i was trying to run a program that executes the operational meaning of +, -, * and / using the keyboard.