Q. 88. Write a program to input a digit and convert the Digit to corresponding Word and Print it.
Copy Code:
#include <iostream>
using namespace std;
int main()
{
char a ;
cout << "Enter a digit ranging from 0 to 9 : "; cin >>a;
switch (a)
{
case '0' : cout << "ZERO"; break;
case '1' : cout << "ONE"; break;
case '2' : cout << "TWO"; break;
case '3' : cout << "THREE"; break;
case '4' : cout << "FOUR"; break;
case '5' : cout << "FIVE"; break;
case '6' : cout << "SIX"; break;
case '7' : cout << "SEVEN"; break;
case '8' : cout << "EIGHT"; break;
case '9' : cout << "NINE"; break;
default : cout << "Not a Digit"; break;
}
return 0;
}
No comments:
Post a Comment