C++ program to take a number between 0 to 9 and print the word representation for that number
0
Following program shows you how to take a number between 0 to 9 and print the word representation for that number.
In this program we get numbers between 0 to 9 from user and print word representation using if condition
#include <iostream>
int main() {
	int input;
	std::cout << "Enter a number between 0 to 9:";
	std::cin >> input;
	if (input == 0) {
		std::cout << "Zero";
	} else if (input == 1) {
		std::cout << "One";
	} else if (input == 2) {
		std::cout << "Two";
	} else if (input == 3) {
		std::cout << "Three";
	} else if (input == 4) {
		std::cout << "Four";
	} else if (input == 5) {
		std::cout << "Five";
	} else if (input == 6) {
		std::cout << "Six";
	} else if (input == 7) {
		std::cout << "Seven";
	} else if (input == 8) {
		std::cout << "Eight";
	} else if (input == 9) {
		std::cout << "Nine";
	} else {
		std::cout << "We don't have word representation for that number";
	}
}
Output:
Example1:
Enter a number between 0 to 9: 4 Four
Example2:
Enter a number between 0 to 9: -1 We don't have word representation for that number