Saturday, March 31, 2012

To Convert an no. entered by the user

This Program takes the no. entered by the user as an string String is converted into a series of int type arrays.The main Objective is to tackle digits greater than 12.Special attention has been given to commas & fullstop used to separate words

Code:

#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
int fchar=0;
char
ones[22][22]={"zero","one","two","three","four","five","six","seven","eigh
t","nine","ten",
"eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","e
ighteen","nineteen"};
char
first[22][22]={"Zero","One","Two","Three","Four","Five","Six","Seven","Eig
ht","Nine","Ten",
"Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","E
ighteen","Nineteen"};
char
tens[10][10]={"twenty","thirty","fourty","fifty","sixty","seventy","eighty
","ninety"};
char
sec[10][10]={"Twenty","Thirty","Fourty","Fifty","Sixty","Seventy","Eighty"
,"Ninety"};
char tenz[10][10]={"hundred","thousand","million","billion"};
void fun2(long);
void main()
{
    clrscr();
    char string[50];
    textbackground(BLUE);
    textcolor(GREEN);
    long i,j;
    long m=1;
    long n[10]={0,0,0,0,0,0,0,0,0,0},no;
    cout<<"Enter the no. ";
    cin>>string;
    for(i=0;string[i]!='

No comments:

Post a Comment