By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,768 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

How to use switch s and functions

P: 1
hello there,

I need your help really fast.Here it is. I need to write a program that input 1-6 number(a choose)i.e the program ask the user to select an option out of 6 option when he does that it excutes that specific program and then in that program there will be another in and outputs.in this case i'm suppose to use the switch...case.I already did the whole program without the function but i'm supposed to use it.
i can not use any kind of libraries like math.h and other only include studio.h ,function and all other statements.
how am i suppose to use it or insert in the program i already did???
thanks everyone....
Dec 5 '10 #1
Share this Question
Share on Google+
1 Reply


100+
P: 542
Get the user to respond to cin>>x; //with 1 to 6 inclusive.
switch(x)
case 1: //do something
;
case 2: //do something else
;
and so on to case 6:
The next and last case is the default: ; // in case x is not //assigned 1 to 6
Dec 5 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.