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
2 Réponses
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 .
0
thanks..a lot