Pages

Tuesday, June 14, 2011

An Introduction to Programming Contest (Various Input\Output Systems)

If you are a beginner, you will find it very unusual sometime regarding taking inputs. Some problems will say, "The Program will continue till the END OF FILE:, some will say "Stop taking input if N=0" etc etc. Some important ways to take input will be described here:

1. If you are said to take an integer number (n) as input till the End Of File/ (EOF):
 
 
int main(){
    int n;
    while(scanf("%d", &n)!=EOF){
         ...........
         ...........
    }
    return 0;
}