Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Str / Str / Str

.cpp
Скачиваний:
32
Добавлен:
19.04.2018
Размер:
535 б
Скачать
// Str.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>


int main()
{
	char str[1000];
	puts("Enter string");
	gets(str);
	int chars[256] = { 0 };
	for (int i = 0; str[i]; i++)
	{
		chars[str[i]]++;
	}
	char symb=0;
	puts("Enter symbol");
	scanf("%s", &symb);
	for (int i = 0; i<256; i++)
	{
		if (char(i)==symb && chars[i]>0)
			printf("Symbol %c repeated again %d times \n", symb, chars[i]);
	}
	return 0;
}

Соседние файлы в папке Str