Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a text file named CSC2144N.TXT using Notepad or other text editor. Copy the following lines of text and paste them into the file and

Create a text file named "CSC2144N.TXT" using Notepad or other text editor. Copy the following lines of text and paste them into the file and save. 10 7.35 -21 45.9 3 -4.56 85 34.1 -9 -32.7 Write a program to declare a structure consisting of an integer member and a float member, and declare an array of the structure with space for at least 10 elements. The program should then open the text file named "CSC2144N.TXT" (that you created above) for input, then read all the numbers from the file into the structure array and then display the following menu to prompt the user to display the number pairs in one of three possible orders: 1. display pairs unsorted 2. display pairs sorted in ascending order of the integer values 3. display pairs sorted in ascending order of the float values 4. exit program Note: the program should work for any number of integer float pairs that might be in the data file, not just 5 pairs. The program should use an adaptation of the exchange sort procedure to perform the sorts. After displaying the values in the desired order, the user should be prompted again with the menu. Note: you should probably have a duplicate array to keep the unsorted values in case the user enters 2 or 3 and then enters 1. Alternatively, you could simply re read the file.

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions