During run-time of a menu driven program, I want the user to see what option the user has entered. Something like this :-
[OUTPUT]
.
.
.
Enter Option : [1] <- [I]User given[/I]
Press Any Key To Continue ... [_] <- [I]Blinking Cursor[/I]
.
.
.
[/OUTPUT]
After I hit enter, the program will continue as usual.
My requirements
- The code should be compiler independent
- Should be a one-liner
- Should not utilize a separate variable
The list is according to my priority. If No. 1 fails, No. 2 should not fail. If No. 2 fails, No. 3 should not fail. If No. 3 fails, then i have nothing more to say
I once tried something like this,
int n;
printf("Enter Any Number & Then Press Enter To Continue ... ");
scanf("%d", &n);
But this looks ugly and I had to use a separate variable.
So, in a nutshell, I'm looking for an alternate of the non-standard getch();