**The Program in C++ to Input any number and print it in words is given below**:

```
#include <iostream>
using namespace std;
string one_digit_number_to_word(int num) {
switch(num) {
case 0: return "zero";
case 1: return "one";
case 2: return "two";
case 3: return "three";
case 4: return "four";
case 5: return "five";
case 6: return "six";
case 7: return "seven";
case 8: return "eight";
case 9: return "nine";
}
return "";
}
string two_digit_number_to_word(int num) {
switch(num) {
case 10: return "ten";
case 11: return "eleven";
case 12: return "twelve";
case 13: return "thirteen";
case 14: return "fourteen";
case 15: return "fifteen";
case 16: return "sixteen";
case 17: return "seventeen";
case 18: return "eighteen";
case 19: return "nineteen";
}
string tens_digit[] = {"", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"};
return tens_digit[num/10] + (num%10 != 0 ? "-" + one_digit_number_to_word(num%10) : "");
}
string three_digit_number_to_word(int num) {
return one_digit_number_to_word(num/100) + " hundred " + (num%100 != 0 ? two_digit_number_to_word(num%100) : "");
}
int main() {
int num;
cout << "Hello Codeauri Family,enter the number here to print it into words:\n";
cin >>num;
if (num < 10) {
cout << one_digit_number_to_word(num) << endl;
} else if (num < 100) {
cout << two_digit_number_to_word(num) << endl;
} else if (num < 1000) {
cout << three_digit_number_to_word(num) << endl;
} else {
cout << "Sorry, Number is too large.Please enter smaller than thhis one" << endl;
}
return 0;
}
```

## Output:

Hello Codeauri Family,enter the number here to print it into words:

299

two hundred ninety-nine

## Pro-Tips**💡**

This program prompts the user to enter a number and then prints the number in words.

It uses three different functions for one digit, two digits and three digit numbers.

The functions use switch case statements to match the digit with the corresponding string.

Then in the main function, it checks if the given number is less than 10,100,1000 and calls the corresponding function.

This program can handle numbers up to 999 and it will print “Number is too large” for any number greater than 999.

Note that this program only works for numbers between 0 and 999, and it doesn’t handle numbers with more digits.

**Learn C-Sharp ↗**

C-sharp covers every topic to learn about C-Sharp thoroughly.

**Learn C Programming ↗**

C-Programming covers every topic to learn about C-Sharp thoroughly.

**Learn C++ Programming↗**

**Learn C++ Programming↗**

C++ covers every topic to learn about C-Sharp thoroughly.