+ 2

Wap to print a digit in its english form.

1-one 2-two like this

4th Dec 2016, 2:35 PM
Amit
Amit - avatar
5 Respuestas
+ 3
maybe you can make array string words["zero","one","two",...] cout<<"enter a digit"; cin>>x; cout<<"it is ."<<words[x]; for many digit it is same just make some more array for tens and then make a loop that divided the no and creates division of three and it will print by using strings in that you will also have to make one for divisio you can then push the divides block in array then reverse it and another loop prints it by joining with division arrays
4th Dec 2016, 3:09 PM
Sandeep Chatterjee
+ 3
that's what I said for more digit you will have to make one more array that stores ten now program will make division of three in this it will not find hundred then take tens from array then take ones from the old array output will be twenty three if it is 467 it will again do same then take four hundred then from tens sixty then seven 1356 in this on division of three it will separate 001 it will be one now other part 356 so it will be 356 and 1 reverse the array and print 1 then the other array as I said will print thousand three hundred fifty six read my previous answers again I said it.
4th Dec 2016, 3:24 PM
Sandeep Chatterjee
+ 3
program will be arrays for words [...] a small method that print hundred ten and once. 234 as two hundred thirty four. a loop that divides no into block and pushes them as elements of array this is other array not for words. 235789 into 789 and 235 a loop that reverses the array 235 789 a loop that take each element of array and prints it's word using small method as I described 235 thousand 789 it will call the small method thus it is done you can make division only after num%1000 so that blocks are different and you need to take care of special nos and you will have to make separate array for tens
4th Dec 2016, 3:32 PM
Sandeep Chatterjee
+ 3
there are many methods to do so this is just an example however in this too if you are getting problem in any part feel free to tell it I answered it in short so
4th Dec 2016, 4:14 PM
Sandeep Chatterjee
+ 2
Thanks... bt if user input is 23.. ??
4th Dec 2016, 3:18 PM
Amit
Amit - avatar