Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- int main(){
- int len_text = 1;
- int len_sen = 1;
- int i=0; // количество предложений
- int j=0; //количество символов в предложении
- char c;
- char** text = calloc(len_text, sizeof(char*));
- text[i] = (char*) calloc(len_sen, sizeof(char));
- do{
- c = getchar();
- if(c == '.' || c == '?' || c == ';'){
- text = realloc(text, sizeof(char*)*(len_text++));
- text[i][j] = c;
- text[i+1] = (char*) calloc(1, sizeof(char));
- i++;
- j=0;
- len_sen = 1;
- } else {
- text[i][j] = c;
- }
- if(j >= len_sen){
- text[i] = realloc(text[i], (len_sen+=1)*sizeof(char));
- }
- j++;
- }while(c != '!');
- int n = 0;
- char f = text[0][0]; //получаем первый символ первого предложения
- for(int m = 0; m <= i; m++){
- while(f != '.' || f != ';' || f != '?'){
- printf("%c", text[m][n]);
- n++;
- if(text[m][n] == text[i][j]){
- break;
- }
- f = text[m][n];
- }
- n = 0;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement