Re: Reading Input Real-Time
Code:
char userInput = NULL; //userInput initialized
/*******************************************************
while userInput not equal to '.', '?', or carriage return and newline or just
carriage return, depending on your system
********************************************************/
while (!(userinput == '.' || userinput == '?' ||userinput == '\r\n'))
{
cin >> userInput
/* The vowel calculation code
* goes here
*/
}
/*
* The if/elseif/else condition to test userInput for one of the delimiting
* characters goes here
*/
if(userinput == '.' || userinput == '?' )
//stop counting vowels, that's all
else
//userInput is equal to carriage return, this part may get dicy, apply your intelligence
//do cleanup work and output of the program
exit(0);
exit(1);
The exit(0) indicates a succesful completion of the program and exit(1) indicates failure. Feel free to use them at free will, but carefully.
If this reply works for you, please mark this thread as [RESOLVED] from the control panel.
Thanks & Regards
Indrajit