C++ programming 2

to use a vector of structs to sort the data. You are

collecting a file of information about students who are applying to your program.

The file contains the first name, last name, GPA, and age of each student. Your

tasks are to 1) read this data in from the user-specified file to a vector of structs

2)sort the data in ascending order by the user-specified criteria, and 3)print the

sorted data to the screen for review.


It will be most helpful to break each activity into a separate function. In my

solution, I wrote the following functions:

A File Reading Function for the vector of structs

Sort functions (based on what option you insert)

A Print Function

Details and Specifications

Collections of data which, together, describe a more complex object are

common in the real world. For example, such information as first name, last name,

social security number, address, and age may be collected together to form a more

complex object called “Person”. In the case of Lab 4, we are collecting first name,

last name, GPA, and age data to represent a student. You need to define a correct

struct to represent student.

The user-specified input file will contain data for a certain number of

students, one on each line.

Each line of the input file has the following format:

<first name, one word string><space><last name, one word string ><space><GPA,

float><space><age, int>

In your main function, you will need to create a vector of student structs.

To read in the students data into vector of students, you should write a

function. The file reading functions should open the user-specified file and read the

student data into the array using sentinel loop logic.

You may use push_back(), size(), and some other functions from <vector>.

To sort the student data for each storage system, you should write a function.

The sorting function should sort students in ascending order (small to large)

according to the criteria the user has specified. These sorting functions should

NOT simply print the sorted order, but should actually modify the student vector in

memory so that they are stored in sorted order.

Printing the data should be straightforward, simply mimic the output from

my example output captures below: (Note: Output menu and sorted table should be

column-aligned using setw( ), you can assume that first and last names will be no

longer than 25 characters)

Your program should have the exact output as following:


Use two files

(1) student.h : declare your student struct

(2) [url removed, login to view]: write your programs in this file

Skills: C++ Programming

See more: world programming system, world programming, vector string, vector sort, vector security, vector order, vector int, vector cpp example, vector cpp, vector cplusplus, struct programming, struct cpp, string vector, string functions cpp, string cpp, string cplusplus, sort vector, sorting logic, sort array, solution programming, social programming, security logic, read vector, programming vector, programming solution

About the Employer:
( 8 reviews ) Southfield, United States

Project ID: #2534372

2 freelancers are bidding on average $70 for this job


Hi, I am C++ expert and can surely help you here, Please check your inbox, Thanks

$40 USD in 1 day
(111 Reviews)

Hi, i can do this job. i will deliver documented sources + exe + help notes. Regards,

$100 USD in 3 days
(0 Reviews)