Some ICPC related programming techniques in c

Sometimes i feel i have to write those in somewhere so i am writing those techniques here which I am learning day by day by reviewing others code….

while(scanf("%d",&k)==1){
if(k==0)
break;
}

Here ==1 means TRUE and the program will enter the loop if anything inside the loop will work except zero 0.

for(;;){
scanf("%d",&k);

if(k==0)
break;

}

Here for(;;) means infinity loop run and everything will work fine except k==0..when zero come program will stop to run

You can also put all of your input in your extended outside text file and load it in the console
by this code

freopen("in.txt","r",stdin);

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *