Hi, I need to do a small process like this:a message will be played like this:"press 1 for analog,press 2 for digital,press 3 to go to previous menu". if i press 1 ,i have to print "analog".if 2 "digital".if 3 ,i have to go to previous menu which plays that message again.Now i did upto pressing 2.but when pressing 3,i dont know how to make it to go back to the same message.i need to put it in any for loop? please assist me.my code follows:
a for-loop is generally used when you know, in advance, exactly how many times you need to loop. in your case, since you don't (and really, can't) know in advance, a for-loop does not seem like the best choice.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Oct 04, 2007
Thanks.But i have done that using for loop like this. . Now what is happening is first i dial a number,it says welcome and ask us to press 0 for complaints.if i press 0 a voice file will tell us to press 1 for analog,2 for digital,3 for previous menu.before this i need to do like this.after saying welcome i need to play a message ("press 1 for english,press 2 for hindi").this should be played 3 times until the condition is satisfied.if the condition is satisfied, the message "for complaints press 0,or else hold the line" should be played.please help me to do this.
Joined: Aug 16, 2007
I concluded below points from your requirements.
1) Welcome message will be played. 2) "Press 1 for English and 2 for Hindi" This message will be played 3-times. 3) "Press 0 for complaints or hold the line". This is Main menu and it should be in loop.
Still i feel this can be achieved through do...while(); loop.
I have modified your code using do...while(); loop.
- "9 to end the call." I have added this condition to exit from the loop.Why do you want to execute the loop(for loop) only 3 times. Here you never know in advance that how many times the loop will be executed.
Is this properly interpreted? [ June 16, 2008: Message edited by: Vishal Pandya ]