Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- void cheakComment(char);
- void lineComment();
- FILE *f1, *f2;
- int main(){
- f1=fopen("input.txt","r");
- f1=fopen("output.txt","w");
- char c;
- while((c=fgetc(f1))!=EOF){
- cheakComment(c);
- }
- fclose(f1);
- fclose(f2);
- return 0;
- }
- void cheakComment(char c){
- if(c=='/'){
- char d;
- d=fgetc(f1);
- if(d=='/'){
- lineComment();
- }
- else{
- fputc(c,f2);
- fputc(d,f2);
- }
- }
- else{
- fputc(c,f2);
- }
- }
- void lineComment(){
- char e;
- while((e=fgetc(f1))!=EOF){
- if(e=='/n'){
- return;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement