Question: I have included the problem and a partial code that I could not finish. Can you help me finish the code? Everywhere there is a

I have included the problem and a partial code that I could not finish. Can you help me finish the code? Everywhere there is a " ??" (question marks) there is where I need help.

Problem

Write a program that turns a number into its English name. Assume the number is a positive integer and less than 1000 (between 1 and 999).

Partial coding

#include #include using namespace std;

string digitNum (int num); string teensNum(int num); string tenNum(int num); string convertNumbertoString(int number);

int main() { int input; //collect user input do { cout << "Please enter a positive integer between 1 and 999. Enter 0 to terminate the program. "< cin >>input; if(input ==0) ?? //exit the program //Write a while loop to validate the input between 1 and 999). //Ask the user to input again until a valid input is entered. ?? cout< }while(input!=0); cout<<"Bye!"< return 0; }

string digitNum(int num){ if (num == 1) return "one"; //?? check digits 2 to 9 }

string teenNum(int num){ if (num == 10) return "ten"; //?? check 11 to 19 r }

string tenNum(int num){ if (num >= 90) return "ninety";

//?? to check 80,70,......, 20. }

string convertNumbertoString(int number){ string name; int holder = number; if(holder >= 100){ name = digitNum(holder/100) + " hundred"; holder = holder % 100; } if(holder >= 20){ name = name + " " + _______________; //?? ______________________________/?? } if(holder >=10){ name= name + " " + ___________________;/?? holder = 0; } if(holder > 0){ name = name + " " + d______________________);/?? } return name; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!