修改文件结构。

This commit is contained in:
unlockable
2023-02-21 10:56:54 +08:00
parent a64cfdd9f3
commit 40182871f4
83 changed files with 0 additions and 0 deletions

31
POP/14/Exercise02.c Normal file
View File

@@ -0,0 +1,31 @@
#include <stdio.h>
char toUpper(char input) {
if (input >= 'a') {
return input - 'a' + 'A';
}
else {
return input;
}
}
int main() {
char ch;
FILE* fl;
fl = fopen("upper.txt", "w+");
while (1) {
ch = getchar();
if (ch == '#') {
break;
}
fprintf(fl, "%c", toUpper(ch));
}
fflush(fl);
// fclose(fl);
// fl = fopen("upper.txt", "r");
rewind(fl);
while(!feof(fl)) {
putchar(fgetc(fl));
}
return 0;
}