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

1 Expert Approved Answer
Step: 1 Unlock

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

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!