Auto commit

This commit is contained in:
2025-03-24 19:46:42 +08:00
parent 21eab878bf
commit 1455f339be
6 changed files with 96 additions and 0 deletions
@@ -0,0 +1,18 @@
#include <stdio.h>
int main(){
FILE *in, *out;
char str[100];
in = fopen("file1.c", "r");//r:只读
out = fopen("file2.c", "w");//w:覆盖
while(fgets(str, 100, in)){//fgets每次从文件获取一行并存储到str中
puts(str);//使用控制台输出
fputs(str, out);//向file2.c输出
}
fclose(in);//关闭文件指针
fclose(out);
return 0;
}
@@ -0,0 +1,18 @@
#include <stdio.h>
int main(){
FILE *fp;
char ch;
int count=0;
fp = fopen("letter.txt", "r");
while((ch=fgetc(fp)) != EOF){
if(ch == 'c'){
count++;
}
}
printf("c个数为:%d\n", count);
return 0;
}
+9
View File
@@ -0,0 +1,9 @@
#include <stdio.h>
int main(){
return 0;
}
+9
View File
@@ -0,0 +1,9 @@
#include <stdio.h>
int main(){
return 0;
}
@@ -0,0 +1 @@
ccadfadsfasfadsfafa