Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Write a C++ program that contains a structure named “Student” having two data members
1) Name
2) CGPADeclare array of structure “Student” of size 10 .Populate this array by taking data from file inputFile.txt.File inputFile.txt contains Name and CGPA of the students for current semester. There is a single space between the Name and CGPA.
Display the un-sorted list of students on screen. Compare the CGPAs of all the students and sort Student List with respect to CGPA in ascending or descending order.
Display the sorted list of students, highest CGPA and lowest CGPA on screen and also write the result in File outputFile.txt with tab characters between the Name and CGPA.Sample inputFile.txt
Ahmer 4.0
Aasim 3.5
Usman 3.4
Maria 2.4
Anila 3.0
Humza 2.6
Junaid 3.0
Talaal 3.8
Haris 3.9
Saira 2.6Sample outputFile.txt
Name CGPA
===============
Maria 2.4
Humza 2.6
Saira 2.6
Anila 3.0
Junaid 3.0
Usman 3.4
Aasim 3.5
Talaal 3.8
Haris 3.9
Ahmer 4.0
===============
Highest CGPA = 4.0
Lowest CGPA = 2.4Sample output of screen:
Unsorted List of Students
Name CGPA
Ahmer 4.0
Aasim 3.5
Usman 3.4
Maria 2.4
Anila 3.0
Humza 2.6
Junaid 3.0
Talaal 3.8
Haris 3.9
Saira 2.6Sorted List of Students
Name CGPA
===============
Maria 2.4
Humza 2.6
Saira 2.6
Anila 3.0
Junaid 3.0
Usman 3.4
Aasim 3.5
Talaal 3.8
Haris 3.9
Ahmer 4.0
===============
Highest CGPA = 4.0
Lowest CGPA = 2.4Bashi Khan

Nice try, but I don't think you'll manage to get one of us to do your homework. You'll only be cheating yourself anyway. The best way to go about getting help here is to attempt to do the task yourself, using your best books for reference. If there is a *specific* point you don't understand, feel free to ask here and we'll try to help.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |