School Commit Init
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include<stdio.h>
|
||||
int main(){
|
||||
FILE *fp;
|
||||
char ch;
|
||||
int length;
|
||||
fp = fopen("homework.txt","r+");
|
||||
if(fp == NULL){
|
||||
printf("File does not exist!");
|
||||
return -1;
|
||||
}
|
||||
while((ch = fgetc(fp)) != EOF){
|
||||
if(ch >= '0' && ch <= '9'){
|
||||
length++;
|
||||
}
|
||||
else if(ch == ' ' && length!=0){
|
||||
fseek(fp,ftell(fp)-length,SEEK_SET);
|
||||
fputc('|',fp);
|
||||
while(length>0){
|
||||
fputc('s',fp);
|
||||
length--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
length=0;
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user