Computing.Net > Forums > Programming > C++ Help Needed

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C++ Help Needed

Reply to Message Icon

Name: bashi
Date: December 14, 2007 at 00:13:47 Pacific
OS: windows XP
CPU/Ram: P-III , 256 MB
Product: COMPAQ
Comment:

Write a C++ program that contains a structure named “Student” having two data members
1) Name
2) CGPA

Declare 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.6

Sample 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.4

Sample 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.6

Sorted 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.4

Bashi Khan



Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: December 14, 2007 at 01:59:28 Pacific
Reply:

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.


0

Response Number 2
Name: Razor2.3
Date: December 14, 2007 at 04:10:42 Pacific
Reply:

While we're on the subject, is anyone else getting an entitlement vibe from bashi?


0

Response Number 3
Name: GhosT
Date: December 21, 2007 at 06:16:29 Pacific
Reply:

how do you use a notepad with C++???
how do you call it???


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: C++ Help Needed

C Help needed www.computing.net/answers/programming/c-help-needed/10424.html

C++ vs Pascal help needed www.computing.net/answers/programming/c-vs-pascal-help-needed/11150.html

C++ help needed www.computing.net/answers/programming/c-help-needed/2816.html