Answer the question
In order to leave comments, you need to log in
It is necessary to make a cyclic shift to the right by 8 positions. Read from file and write to file. What's wrong?
int main() {
FILE* bb, * aa;
int n, i, j;
char str[100], c;
fopen_s(&bb, "text1.txt", "w"); // Открываем файлы для чтения и для записи
fopen_s(&aa, "text.txt", "r");
printf("Vvedite kolichestvo simvolov\n");
scanf_s("%d", &n);
c = fgetc(aa);
i = 0;
while (c != EOF) { // Заполняем массив символами
str[i] = c;
i++;
c = fgetc(aa);
}
char t = str[0],x;
for (int i = 0; i < 8; i++) {
str[0] = str[n - 1];
for (int j = 0; j < str[n]; j++) {
x = str[j];
str[j] = t;
t = x;
}
fputc(str[i], bb);
}
fclose(bb); // Закрываем оба файла.
fclose(aa);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question