Hi i'm new to using c++ and i would like to ask if you could help me out. I have to somehow get a working c++ program that will allow me to convert any one, two or three digit positive integer into words using string/array method. Say, 111 will be converted into one hundred and eleven. I would greatly appreciate it if you could help me out.
Jump to Post
I would put the numerical representation of the number into an std::string. From here you can access each digit separately:
std::string number = "123"; std::cout << number; //outputs '1'
You would then have to have a giant switch statement to convert a '1' to "one", etc.
All 5 Replies
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.