Добавил:
Upload
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:prg-sem-sp / 2 / Задача23
.CPP// Џа®жҐв б«®ў б г¤ў®Ґ®© б®Ј« б®©
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <alloc.h>
# define ENTER 13
# define alphabet "ЎўЈ¤¦§Є«¬Їабвджз"
void main (void)
{int n=80,i,j,true=0,words=1,doubles=0;
char ch,*input=(char*)calloc(n,sizeof(char));
clrscr();
puts("ENTER-Є®Ґж ўў®¤ ");
for(i=0;(ch=getche())!=ENTER;i++)
{if(i==n-1){n+=80;input=(char*)realloc(input,n*sizeof(char));}
input[i]=ch;
if(ch==' ')words++;
for(j=0;j<=16;j++)
if(input[i-1]==alphabet[j]&&input[i-1]==input[i]&&true!=words)
{doubles++;true=words;}
}input[i]=NULL;
puts("\n‚ и ⥪бв:");
puts(input);
printf("‚ ⥪б⥠%i%% б«®ў б г¤ў®Ґ®© б®Ј« б®©",(doubles*100)/words);
free(input);
getche();
}
Соседние файлы в папке 2