Page 1 of 1

ending the input

Posted: Tue Jun 01, 2004 11:22 pm
by zille
in many problems it is said that there will be a blank line ... how is blank line taken as input ... how can the enter key can be taken as input

similarly the other problem is that in some problems it is not mentioned that how the input will end what to do in that case

Posted: Fri Jun 18, 2004 9:10 pm
by jagadish
you may just read off the blank line by using scanf("\n") or scanf("%c",dummy);
when there is no information as to how input will end termination by EOF is implied you may use either use scanf("...",<arguments)!=EOF){ <process> }
or while(!feof(stdin)){ <process>} to handle this.