Is there any command which can be used to take that particular step | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there any command which can be used to take that particular step

for eg. I want to make a calculator program and for that I want it in such a way that if u right add it starts using add program, if u say multiply it start using multiply...like this..if there is any such please tell and I would be thanksfull to u if give me the whole program written

17th Dec 2016, 5:14 AM
rishabh gupta
rishabh gupta - avatar
2 Answers
0
Ya, its l possible . by using switch case example : int main () { int x; cin>> x; \\ user input switch (x){ case 1: add(arg, arg); \\add function break; case2: mul(arg, arg); break ; case3: div(arg, arg ) break ; . . . default : cout<<choose the right option : break; } return 0 ; } integer is x user input act like option for add , division , multiplication etc. hope I answered your question , if not please revert back .
17th Dec 2016, 6:28 AM
Mock
Mock - avatar
0
thanks..a lot
17th Dec 2016, 6:29 AM
rishabh gupta
rishabh gupta - avatar