-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdz12.cpp
More file actions
45 lines (44 loc) · 1.13 KB
/
dz12.cpp
File metadata and controls
45 lines (44 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <stdio.h>
#include <string.h>
//a change capital letters to small ones
//b reverse rewrite
int main()
{
FILE* filepoint4;
char str4[128];
char res[128];
char ch;
errno_t err_4;
int j3 = 0;
err_4 = fopen_s(&filepoint4, "fisrt.txt", "r");
if ((err_4) != 0) {
printf("err_4");
}
else {
if (filepoint4 == NULL) { printf("error1\n"); return -1; }
fgets(str4, sizeof(str4)-1, filepoint4);
printf("\ns =%s", str4);
}
fclose(filepoint4);
for (int j = 0; j < 128-1; j++) {
res[127 - j] = str4[j];
}
printf("\n");
for (int j = 0; j < 128; j++) {
if (res[j] >= 65 && res[j] <= 90) {
res[j] = res[j] + 32;
}
printf("%c", res[j]);
}
err_4 = fopen_s(&filepoint4, "first.txt", "w");
if ((err_4) != 0) {
printf("err_4");
}
else {
if (filepoint4 == NULL) { printf("error1\n"); return -1; }
for (int i = 0; i < 128; i++) {
fprintf(filepoint4, "%c", res[i]);
}
}
return 0;
}