Question: Write a program that reads an unknown number (but no more than 100) of integer values from a file (ass5_Q4_input.txt), and displays distinct number. (i.e.
Write a program that reads an unknown number (but no more than 100) of integer values from a file (“ass5_Q4_input.txt”), and displays distinct number. (i.e. if number appears multiple time, it is displayed only once.)
- A while loop can be used to read integer values (one number at a time) till end of the file is reached.
- An array (with maximum size 100) can be used to store inputted number.
- Each inputted number will be stored into the array only if it is new. Otherwise discard it.
- At the end, the array contains only distinct numbers, therefore can be displayed.
Step by Step Solution
3.38 Rating (160 Votes )
There are 3 Steps involved in it
Certainly Lets break down the program into several steps to ensure clarity in both understanding and implementation Step 1 File Reading 1 Open the fil... View full answer
Get step-by-step solutions from verified subject matter experts
