1 #include <stdio.h> 2 main() 3 { 4 FILE * fp_i; 5 FILE * fp_o; 6 fp_i = fopen("input.txt", "r"); 7 fp_o = fopen("output.txt", "w"); 8 char ch; 9 int sign; 10 while((ch=fgetc(fp_i)) != EOF){ 11 if (ch == '/' ){ 12 13 ch=fgetc(fp_i); 14 if (ch == '/'){ 15 while(ch != ' '){ 16 ch=fgetc(fp_i); 17 } 18 fputc(' ', fp_o); 19 20 }else if(ch == '*'){ 21 ch = fgetc(fp_i); 22 sign = 0; 23 while(sign != 1 && ch != ' '){ 24 if (ch == '*'){ 25 ch = fgetc(fp_i); 26 if (ch == '/'){ 27 sign = 1; 28 } 29 }else{ 30 ch = fgetc(fp_i); 31 } 32 } 33 fputc(' ', fp_o); 34 35 }else{ 36 fputc('/', fp_o); 37 fputc(ch, fp_o); 38 } 39 }else{ 40 fputc(ch, fp_o); 41 } 42 } 43 fclose(fp_i); 44 fclose(fp_o); 45 }