+ 1
How to directly add basic calculation signs in c programming?
I was just trying to program in c. I'm using cell phone rather than pc. I wanted program calculator, where you can directly give input like 2+3 which will give answer 5 rather than preselecting the operator. I can initialize two float or integer for number input using scanf to call the user input. BUT HOW CAN I MAKE THAT OPERATOR USER INPUTABLE? Please, if anyone have good idea on it, it will be highly appreciate. May you have simple solution, but I being beginner had a lot of problems on it. Your help is highly appreciated.
5 ответов
+ 2
You can write the input statement as follows-
float x,y;
char op;
scanf("%f%c%f, &x, &op, &y);
This will automatically break up 5+2 into individual groups.
Make sure you dont include spaces in the input format.
It shouldn't be something like 5 + 2. Avoid spaces.
+ 1
Thank you very much and really sorry I couldn't upvote your kind help for me. It says my account is not activated. I couldn't get where to activate my account. I couldn't find in settings nor in my mail. Hope you won't mind. Really appreciated your kind help.. Thank you
+ 1
No problem bro... you can add your email sort of thing, then it will automatically do it for you..
You can open your account in a PC, then do the activation. This might help
+ 1
Thank you. I will try. Since I'm home under lockdown coz of Corona, I don't have access to PC. Once I'm back I will try as you said. Thanks
+ 1
Tenzin Dorji
Most welcome bro