Добавил:
Upload
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:prg-sem-sp / 3 / S3
.CPP// Сколько раз введенное слово
#include <stdio.h>
#include <string.h>
#include <alloc.h>
void main(){
char *s=(char *)malloc(80),*q=(char *)malloc(80);int col=0;
printf("Input string:");
gets(s);
printf("Input word:");
gets(q);
while((s=strstr(s,q))!=NULL)
{
if(s[strlen(q)]==' '||s[strlen(q)]=='\0') col++;
s+=strlen(q);
}
printf("%d",col);
}
Соседние файлы в папке 3