[ create a new paste ] login | about

Link: http://codepad.org/7LG4EKWZ    [ raw code | fork ]

C++, pasted on Nov 21:
#include <iostream>
#include <cstdio>
int main()
{
	int c;
	int char_count = 0;
	int num_count = 0;
	int up_count = 0;
	int low_count = 0;
	int space_count = 0;
	int other_count = 0;
	while((c = std::getchar()) != '\n')
	{
		char_count++;
		if('0' <= c && c <= '9')
			num_count++;
		else if('A' <= c && c <= 'Z')
			up_count++;
		else if('a' <= c && c <= 'z')
			low_count++;
		else if(c == ' ')
			space_count++;
		else
			other_count++;
	}
	std::cout << "1 全文字の合計文字数 : " << char_count << std::endl;
	std::cout << "2 数字の文字数 : " << num_count << std::endl;
	std::cout << "3 英大文字の文字数 : " << up_count << std::endl;
	std::cout << "4 英小文字の文字数 : " << low_count << std::endl;
	std::cout << "5 空白の文字数 : " << space_count << std::endl;
	std::cout << "6 その他の文字の文字数 : " << other_count << std::endl;
}


Create a new paste based on this one


Comments: