0

Write a program for an application that does not tolerate erroneous input data. Therefore, the data values are prepared by entering them twice by the user. Two lists are made by getting positive integers from the user, separated by a negative number. These two lists of numbers should be identical; if they are not, then a data entry error has occurred.

• Example:
User enters list
17
14
8
-5
17
14
8
The lists are identical. However see the following input

User enters list
17
14
8
-5
17
12
8
Program should show data entry error.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Ancient Dragon
1

First you have to use a loop to find the negative value. Once found, start another loop to compare each of the values from the beginning of the array to the one past the negative number.

For example: let int i be a counter that finds the negative number. Let j be a counter the counts from 0 up to the value of i (where the negative value is located) Now, in a loop compare array[i[ with array[j], then if they are the same increment both i and j. If it gets to the end of the array then both arrays are identical.

And no, I won't write it for you -- its your job to figure out how to do it.

Edited by Ancient Dragon

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.