The program I am building runs in an infinite while loop with a switch case in it. I want to insert a while loop under each case and perform few operations in the loop, but the loop should exit as soon as a keyboard input is given. So that after taking the input from keyboard another case is run with the nested while loop in it, and the process continues.
The structure is:
while()//infinite loop
{
............... //operations
............... //operations
switch()
{
case 1:
............... //operations
............... //operations
while()//infinite loop
{
..............
..............
exit if there is any input from keyboard
}
break;
case 2:
............... //operations
............... //operations
while()//infinite loop
{
..............
..............
exit if there is any input from keyboard
}
break;
case n:
............... //operations
............... //operations
while()//infinite loop
{
..............
..............
exit if there is any input from keyboard
}
break;
}
}
Is there any way to do it???