You are required to write a C++ program to covert a positive inter code into English name equivalent for the digit. A valid code is of size between four (4) to six (6) digits inclusive. A zero is not allowed in a code.

Example:
If input is 234056 the output is: IVALID CODE(Presence of zero)
If input is 23456 the output is: TWO THREE FOUR FIVE SIX
If input is9349 the e output is: NINE THREE FOUR NINE
If input is245 the output is: INVALID CODE(3 DIGITS)
If input is 2344567 the output is: INVALID CODE (7 DIGITS)

Steps to follow to write the program as follow:

Step1 Input cod

Step2 Count the number of digits in the code

Step3 If there is a zeroin the code, “Invalid Code(presence of zero)”else GOTO step4

Step4 If number of digits is mode of equal than 4 and less or equal than 6, GO TO step 5 else display the following message “INVALID CODE (<number of digits>DIGITS)

Step5 Call function called digit_name tocovert each digit into its equivalent English name.
Display the result

Step6 Print the digits in reverse order.Eg; if input is 13453, reverse order is 35431

Overall valid output: (example)
Input in 12345
Output is:ONE TWO THREE FOUR FIVE
Reverse order of code: 54321

Important:Use array. Loops and function appropriately

Recommended Answers

Please don't just post your assignment. Also post an honest attempt along with the difficulties you're having as proof of effort. Daniweb is not a homework service.

Jump to Post

All 3 Replies

Please don't just post your assignment. Also post an honest attempt along with the difficulties you're having as proof of effort. Daniweb is not a homework service.

I still dont take this subject but I want to know how to do it >> coz I saw defferent answers in google
ex >> they put function like ( cout , cin )
I thought we can use (printf , scanf )

my friends told me " you will take c++ in next semester "
thats why I want to know it

That doesn't make it any less of a homework assignment according to our rules.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.