Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Unfortunately the auto grade system requires the formatting to have an exact match. Unfortunately I still struggle with matching exact format output when it comes

Unfortunately the auto grade system requires the formatting to have an exact match. Unfortunately I still struggle with matching exact format output when it comes to line breaks and new lines. For this assignment I need the output to remain the same as I have it for numbers greater than or equal to 1(example Diff 2), but I need my error message for all invalid inputs to match that of the expected output in the last photo. I've included the original assignment, my code and the auto grade system message. Please help!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Reverse Number Overview For this daily, write a program that will display N and the digits of N in reverse order with leading 0 s, as needed. For example, if N is 12300 , the program should display Original: 12300 Reversed: 00321 A CPP file (reverse.cpp) has been provided. It contains the declaration for an integer variable (N) and code that will ask the user to enter an integer value. Add code that will check the N value for validity. To be valid, the N value must be positive. If an invalid N value is entered, display an error message and ask the user for a new N value. This should continue until a valid N value is entered. The error message displayed to the user MUST match the message that is displayed in the output below. Once a valid N value has been entered, display the original N value. Write a loop that will display the digits of N in reverse order, one digit at a time. Print a new line at the end of the output. Hint What is the quotient when an integer value is divided by 10 ? What is the remainder when an integer value is divided by 10 ? What is the new quotient if the original quotient is divided by 10 ? What is the remainder when the original quotient is divided by 10 ? File You Must Submit Place the completed program code in a source file named reverse. cpp Output The output that is produced by the program will vary based on the values that are entered when the program is executed. The output that is shown below is what the program will produce when it is run in an environment such as Dev C++ or XCode. When it is run through the Auto Grader, the portion that asks for the integer value and error message WILL NOT show the value that is entered. Some examples of running the program follow: N value (must be positive) ? 1 Original: 1 Reversed: 1 N value (must be positive)? 14 Original: 14 Reversed: 41 N value (must be positive)? 100 Original: 100 Reversed: 001 N value (must be positive)? 12300 Original: 12300 Reversed: 00321 N value (must be positive)? 23032 Original: 23032 Reversed: 23032 N value (must be positive)? 0 Error: the N-value must be positive. Try again: -4 Error: the N-value must be positive. Try again: -5 Error: the N-value must be positive. Try again: 0 Error: the N-value must be positive. Try again: 12345678 Original: 12345678 Reversed: 87654321 Output for diff 2: Expected output: Original: 12345678 Reversed: 87654321 Your output: Original: 12345678 Reversed: 87654321 Differences: 1c1 Found differences

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions