Hello again coders, I have another project to do. So far so good I would say. Just one issue with it. It's asking me to make the program accept input and produce output similar to the example program execution. Enter Y/y to convert a telephone number from letters to digits. Enter any other letter to terminate the program "Y". The corresponding telephone number is: 435-5696 to process another telephone number, enter Y/y to enter any other letter to terminate the program "z".
After plugging in the code, it checks to see if the code works. As you can see, it comes out as:
Input: Y
Programming
z
Output: Enter a phone number in letters only.
Y
9Programming
77-6472z
The result needs to be 776-4726. Crazy how this sounds, I thought I had this part down. I would appreciate it if you coders can explain how this works. Thank you coders for taking your time.
Your program is missing a loop that would enable it to convert multiple phone numbers. I know you said it only needs to produce output similar to the example, but being able to run multiple times strikes me as an important requirement.
You have a good approach, but you might want to check if you would get points taken off for your program behaving oddly if someone doesn't enter a full phone number before hitting Enter. If you want to be sure you won't, then… have you read about std::ostringstream? An std::string would work fine as well, but ostringstreams are useful in that you could replace many of your couts with them, and not change much else.
Starting at line 23 you might consider changing "counter" to "idx" or "index" for better readability. Also you should define "counter" or "idx" in the for loop because that is the only place it is used and it will be destroyed when the loop ends.