C++ Program for Print Number to Word
Master C++ with Real-time Projects and Kickstart Your Career Start Now!!
Program 1
// Program to print word format of number
#include<iostream>
using namespace std;
int main()
{
int n,r,s=0;
cout<<"Enter a number";
cin>>n;
system("cls");
// Reverse of number
while(n!=0)
{
r=n%10;
s=s*10+r;
n=n/10;
}
while(s!=0)
{
r=s%10;
switch(r)
{
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;
}
s=s/10;
}
}
You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

