Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  inundation
Language: C/C++
Code:
#include <stdio.h>
void main()
{
     FILE *fp1,*fp2;
     int i;
     char c,t;
     fp1=fopen("input.txt","r");
     fp2=fopen("output.txt","w");
     c=getc(fp1);
     while(c!=EOF)
     {
          if(c=='{' || c=='}' || c==';' || c=='>')
          {
               putc(c,fp2);
               putc('\n',fp2);
          }
          else if(c=='(')
          {
               while(c!=')')
               {
                    putc(c,fp2);
                    c=getc(fp1);
               }
               putc(c,fp2);
               t=getc(fp1);
               if(t!=';')
                    putc('\n',fp2);
               ungetc(t,fp1);
          }
          else
               putc(c,fp2);
          c=getc(fp1);
     }
     fclose(fp1);
     fclose(fp2);
     printf("inundation finished");
}
          
Comments: