Question: Write a program that reads a comma- delimited file of student information, and stores them in an array of structures. Then provide following functionalities for

Write a program that reads a comma-delimited file of student information, and stores them in an array of structures. Then provide following functionalities for the user: write program in C

  1. 1- Print records.

  2. 2- Sort by Last name.

  3. 3- Search by Id.

  4. 4- Exit.

    • The student data is in student.txt file.

    • Your program should read the file and store Id, First Name, Last Name and score in an

      array of structure.

o Id: integer

o First Name: array of char of size 50. o Last Name: array of char of size 50. o Score: double.

In student.txt: o Token are separated by comma. o The first line contains the header of columns. o The file contains the information of 200 students. o The maximum character at each line is 150. o There are some irrelevant columns, that your program should ignore them.

  • When user enters 1 the program should print all records in the output.txt file. The records include id, first name, last name and score.

  • When user enters 2 the program should sort all records based on students last name.

  • When user enters 3 the program asks user to input the id, e.g. sid, and then prints the

    first name and last name of the of the student whose id is sid.

  • Program keeps asking user to enter the command, unless the user enters 4.

  • Note that the program may produce different output.txt file. If user sort records

    before printing, the file contains sorted records. If not, records will be printed in the same order as the student.txt file.

    Sample output: (user input are bold) o Please enter the command:

    Print records (press 1)

    Sort by Last name (press 2) Search by Id (press 3)

    Exit (press 4)

    1

    Please enter the command: Print records (press 1)

    Sort by Last name (press 2) Search by score (press 3) Exit (press 4)

    2

    Please enter the command: Print records (press 1)

    Sort by Last name (press 2) Search by score (press 3) Exit (press 4)

    1

    Please enter the command: Print records (press 1)

    Sort by Last name (press 2) Search by score (press 3) Exit (press 4)

    3

    Please enter Id:

    10100

    10100,Golda,Schlager

    Please enter the command: Print records (press 1)

    Sort by Last name (press 2) Search by score (press 3) Exit (press 4)

    4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!