[ create a new paste ] login | about

Link: http://codepad.org/OcsQg8ft    [ raw code | output | fork ]

C++, pasted on Dec 22:
#include <locale>
#include <iostream>


int main()
{
	setlocale(LC_ALL, "");

	const char* text[] = {"zero", "one", "two", "three", "four", "five", "six", "se7en", "eight", "nine"};

	int digits[256] = {0};

	int val = 78096;

	int tmp = val;	
	size_t count = 0;

	for (; tmp; tmp /= 10, count++)
	{
		int d = tmp % 10;
		digits[count] = d;
	}

	for (int i=count-1; i>=0; i--)
		std::cout << text[digits[i]] << " ";

	std::cout << std::endl;

	return 0;
}


Output:
1
se7en eight zero nine six 


Create a new paste based on this one


Comments: