2 sentences are given (1e ends with a dot; sentences are separated by a space). It is necessary to change the sentences in places.
It is desirable to do on arrays, without unnecessary C ++ functions.
Look plz, I wrote on VS 2010. I did, but it does not work for me (it produces various kinds of errors, I suppose problems with the compiler):
#include<windows.h> // ΠΡΠ·ΠΎΠ² Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠΈ Π΄Π»Ρ ΡΠΌΠ΅Π½Ρ ΠΊΠΎΠ΄ΠΈΡΠΎΠ²ΠΊΠΈ #include<iostream> // ΠΡΠ·ΠΎΠ² Π±ΠΈΠ±Π»ΠΈΠΎΡΠ΅ΠΊΠΈ Π΄Π»Ρ Π·Π°Π΄Π΅ΡΠΆΠΊΠΈ ΡΠΊΡΠ°Π½Π° #include<stdio.h> #define SZ 70 void main (void) { SetConsoleOutputCP(1251); // Π‘ΠΌΠ΅Π½Π° ΠΊΠΎΠ΄ΠΈΡΠΎΠ²ΠΊΠΈ Π½Π° "windows-1251" FILE *In; In = fopen("In.txt", "r"); // Π² ΡΠ°ΠΉΠ»Π΅ 2 ΠΏΡΠ΅Π΄Π»ΠΎΠΆΠ΅Π½ΠΈΡ char s[SZ]; int end, i; // Π²Π²ΠΎΠ΄ ΡΡΡΠΎΠΊΠΈ ΠΈΠ· ΡΠ°ΠΉΠ»Π° Π² ΠΌΠ°ΡΡΠΈΠ² s for(i = 0; i < SZ; i++){ fscanf(In, "%c", s[i]); } fclose(In); // ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ ΠΊΠΎΠ½ΡΠ° 1Π³ΠΎ ΠΏΡΠ΅Π΄Π»ΠΎΠΆΠ΅Π½ΠΈΡ for(i = 0; i < SZ; i++){ if (s[i] == '.'){ end = i; break; } } // Π²ΡΠ²ΠΎΠ΄ 2Π³ΠΎ ΠΏΡΠ΅Π΄Π»ΠΎΠΆΠ΅Π½ΠΈΡ for(i = end + 2; i < SZ; i++){ printf("%c", s[i]); } printf(" "); // Π²ΡΠ²ΠΎΠ΄ 1Π³ΠΎ ΠΏΡΠ΅Π΄Π»ΠΎΠΆΠ΅Π½ΠΈΡ for(i = 0; i <= end; i++){ printf("%c", s[i]); } system("pause"); }
After starting the program, an error flies:
Unhandled exception in "0x5ba8de8f (msvcr100d.dll)" in "it_lab_6.exe": 0xC0000005: Access violation when writing "0xffffffcc".
indicating the source file input.c:
#ifndef _UNICODE *(char *)pointer = (char)ch; pointer = (char *)pointer + 1;