Hi,
I am writing a code in a class that will change the user input which is integer to a string. For example if the user enter 13347..the output should change to "one three three four seven" on the user screen.I'm not getting the right output.
please help with the code below
1) You are assigning a int to a array of strings
2) your subscript usage is wrong. Array subscripts start at 0 and go up to arraySize-1. In your case subscript 9 will mean it is out of range.
3) You havent taken care of zero
4) Your program will work only for single digit numbers
5) You will need another array (or vector) of strings to store the result of conversion, in case you are going to modify your program to cater for numbers greater than 9.
If not then instead of assignment like that on line 15, 19 etc. cout the directly like cout << arr[num];. you dont even need those if statements, as long as you can ensure that user enters numbers from 0-9 only