SlideShare a Scribd company logo
1 of 7
Download to read offline
Program 24 "Sorting Students" Write a C++ program that will open a file named stDATA.txt.
This file contains an unknown number of student records, one per line. The total number of
records will be less than or equal to 100. Your program should print a list of students sorted by
GPA. If two students have the same GPA they should be sub-sorted by classification (SR, JR,
SO, FR). If two students have the same GPA and the same classification, they should be sub-
sorted by last name. If two students have the same GPA, classification, and last name they
should be sub-sorted by first name. If two students have the same GPA, classification, last name
and first name, the second student's record should not be printed; instead the message: "I
THINK THIS IS A DUPLICATE RECORD" should be printed. [edit]Deliverables main.cpp
prog24Functions.h prog24Functions.cpp Sample data file: FirstName LastName CLASS ZIP
AGE HomeTown GPA Hailee Ferrel FR 72275 20 Layton 3.63 Perry Caldwell-Reed SO 4164
19 Racine 2.96 Andrew Dawson JR 39123 21 Huntington 2.29 William Senser SR 15886 25
Fontana 2.14 Shelby Santiago FR 57021 23 Winter 3.15 Matthew Brannon SO 54064 18 Santa
3.35 Christopher Kou JR 31907 22 Monroe 2.36 Cassidy Monjaras SR 41928 24 Jefferson 2.13
Lauren Shah FR 65008 23 Visalia 2.66 Jonathan Quintanilla SO 79343 16 Howell 3.69 Andrew
Chen JR 86176 18 Brownsville 3.32 Brendel Unruh SR 37743 20 Lansing 2.48 Christopher
Royse FR 8095 22 Anchorage 3.98 Jose Harrison SO 33128 17 Greenville 2.09 Alexander
Seiford JR 96517 16 Greenville 2.88 Quinton Johnson SR 56102 20 Winston 3.89 Tristan
Gardner FR 74489 21 Brighton 2.22 Alexander Motz SO 49195 24 Cathedral 3.13 Molly Atkins
JR 27698 15 Des 3.54 William Savells SR 17951 19 Shreveport 3.16 Shawn Wilcoxen FR 86284
21 Syracuse 3.11 Austin Hardy SO 73491 15 Birmingham 2.52 Jason Ammons JR 94515 22
Atlanta 2.86 Phillip Dutta SR 19503 19 Milwaukee 2.34 Wesley Elliott FR 8885 17 Eugene 2.64
Alexander Childers SO 55503 17 Thornton 2.76 Cameron Jones JR 77131 20 New 2.56 Jessica
Louis SR 66868 24 Asheville 3.41 Ryan Kliphon FR 6054 16 Kissimmee 3.26 Zachariah
Qureshi SO 18845 19 Harlingen 2.65 Ryan Cadenas JR 35181 16 Olathe 3.45 Chandrima Bryant
SR 64898 18 Chicago 3.74 Doraliz Hansen FR 30588 23 Boston 2.61 Alonso Greer SO 94115
20 Victorville 3.19 David Llamas JR 84133 19 Hesperia 2.54 Caleb Dylag SR 35101 15
Sebastian 3.91 Rachel Zust FR 42196 16 Westminster 2.74 Tyler DeRosa SO 14421 19
Westminster 3.21 Kendall Sedate JR 43036 22 Moreno 2.29 Matthew Ortiz-Vitali SR 14801 22
Cary 2.03 Ryan Al-Nimri FR 53238 16 Mission 3.75 Daniel Dratz SO 59534 22 Mission 2.83
Weston Gage JR 56011 18 Macon 2.43 Asad Riggins SR 67131 25 Macon 2.06 John Thompson
FR 15386 21 Olympia 3.82 James Seunsom SO 42143 21 Richmond 3.58 Corbin Bodden JR
32787 16 Provo 2.96 Allison Veselka SR 99047 21 Wilmington 3.35 Shawn Renton FR 74027
24 Fort 2.21 Michael Martin SO 74146 16 Bryan 2.82 Austin Huizinga JR 49494 15 Leominster
3.35 Caleb Berkovsky SR 3711 24 Leominster 3.51 Taylor Brown FR 69305 24 Kailua 2.18
Elizabeth Taylor SO 54950 17 Tempe 2.95 Alexandra Itskin JR 35943 16 Denver 3.12 Reagan
Zipoy SR 3892 16 Pomona 2.70 Edgar Leblanc FR 52703 22 Riverside 3.12 Brian Stevens SO
93293 23 Nashua 3.26 Sam Pearson JR 69161 17 Danbury 3.14 Colin Peterson SR 77027 24
Gulfport-Biloxi 2.72 Diana Sharpe FR 65253 22 Palmdale 3.35 Ching-Jung Labrada SO 48635
20 Aberdeen 3.93 Roberto Haddad JR 69486 19 Escondido 2.70 Mahlet Shifflet SR 82554 15
Appleton 3.32 Parker Miller FR 93219 20 South 2.32 Matthew Leake SO 49468 19 Mesa 3.55
Corey McBrayer JR 71592 18 Santa 2.45 David Tramontano SR 38229 24 Murrieta 3.51 John
Rundquist FR 78321 16 Clarke 2.42 Caroline Christenberry SO 42590 24 Poughkeepsie 3.04
Ashley Thomas JR 86691 17 Louisville 2.95 Kyle Andras SR 43291 25 Bakersfield 2.62 Trey
Bolling FR 74843 16 Muskegon 3.79 Adam Brown SO 76537 21 Fort 3.89 Michael Handley JR
58339 19 Lancaster 2.29 Andrew Zinah SR 88135 22 Odessa 3.55 Shawn Wilcoxen FR 86284
21 Syracuse 3.11 Austin Hardy SO 73491 15 Birmingham 2.52 Jason Ammons JR 94515 22
Atlanta 2.86 Phillip Dutta SR 19503 19 Milwaukee 2.34 Wesley Elliott FR 8885 17 Eugene 2.64
Phillip Dutta SR 19503 19 Milwaukee 2.34 Wesley Elliott FR 8885 17 Eugene 2.64 Diana
Sharpe FR 65253 22 Palmdale 3.35 Diana Sharpe FR 65253 22 Palmdale 3.35 Diana Sharpe FR
65253 22 Palmdale 3.35 Sample Output: First Name Last Name Class Zip Age HomeTown GPA
Matthew Ortiz-Vitali SR 14801 22 Cary 2.03 Asad Riggins SR 67131 25 Macon 2.06 Jose
Harrison SO 33128 17 Greenville 2.09 Cassidy Monjaras SR 41928 24 Jefferson 2.13 William
Senser SR 15886 25 Fontana 2.14 Taylor Brown FR 69305 24 Kailua 2.18 Shawn Renton FR
74027 24 Fort 2.21 Tristan Gardner FR 74489 21 Brighton 2.22 Andrew Dawson JR 39123 21
Huntington 2.29 Michael Handley JR 58339 19 Lancaster 2.29 Kendall Sedate JR 43036 22
Moreno 2.29 Parker Miller FR 93219 20 South 2.32 Phillip Dutta SR 19503 19 Milwaukee 2.34
I THINK THIS IS A DUPLICATE RECORD I THINK THIS IS A DUPLICATE RECORD
Christopher Kou JR 31907 22 Monroe 2.36 John Rundquist FR 78321 16 Clarke 2.42 Weston
Gage JR 56011 18 Macon 2.43 Corey McBrayer JR 71592 18 Santa 2.45 Brendel Unruh SR
37743 20 Lansing 2.48 Austin Hardy SO 73491 15 Birmingham 2.52 I THINK THIS IS A
DUPLICATE RECORD David Llamas JR 84133 19 Hesperia 2.54 Cameron Jones JR 77131 20
New 2.56 Doraliz Hansen FR 30588 23 Boston 2.61 Kyle Andras SR 43291 25 Bakersfield 2.62
Wesley Elliott FR 8885 17 Eugene 2.64 I THINK THIS IS A DUPLICATE RECORD I THINK
THIS IS A DUPLICATE RECORD Zachariah Qureshi SO 18845 19 Harlingen 2.65 Lauren
Shah FR 65008 23 Visalia 2.66 Roberto Haddad JR 69486 19 Escondido 2.70 Reagan Zipoy SR
3892 16 Pomona 2.70 Colin Peterson SR 77027 24 Gulfport-Biloxi 2.72 Rachel Zust FR 42196
16 Westminster 2.74 Alexander Childers SO 55503 17 Thornton 2.76 Michael Martin SO 74146
16 Bryan 2.82 Daniel Dratz SO 59534 22 Mission 2.83 Jason Ammons JR 94515 22 Atlanta 2.86
I THINK THIS IS A DUPLICATE RECORD Alexander Seiford JR 96517 16 Greenville 2.88
Ashley Thomas JR 86691 17 Louisville 2.95 Elizabeth Taylor SO 54950 17 Tempe 2.95 Corbin
Bodden JR 32787 16 Provo 2.96 Perry Caldwell-Reed SO 4164 19 Racine 2.96 Caroline
Christenberry SO 42590 24 Poughkeepsie 3.04 Shawn Wilcoxen FR 86284 21 Syracuse 3.11 I
THINK THIS IS A DUPLICATE RECORD Edgar Leblanc FR 52703 22 Riverside 3.12
Alexandra Itskin JR 35943 16 Denver 3.12 Alexander Motz SO 49195 24 Cathedral 3.13 Sam
Pearson JR 69161 17 Danbury 3.14 Shelby Santiago FR 57021 23 Winter 3.15 William Savells
SR 17951 19 Shreveport 3.16 Alonso Greer SO 94115 20 Victorville 3.19 Tyler DeRosa SO
14421 19 Westminster 3.21 Ryan Kliphon FR 6054 16 Kissimmee 3.26 Brian Stevens SO 93293
23 Nashua 3.26 Andrew Chen JR 86176 18 Brownsville 3.32 Mahlet Shifflet SR 82554 15
Appleton 3.32 Diana Sharpe FR 65253 22 Palmdale 3.35 I THINK THIS IS A DUPLICATE
RECORD I THINK THIS IS A DUPLICATE RECORD I THINK THIS IS A DUPLICATE
RECORD Austin Huizinga JR 49494 15 Leominster 3.35 Matthew Brannon SO 54064 18 Santa
3.35 Allison Veselka SR 99047 21 Wilmington 3.35 Jessica Louis SR 66868 24 Asheville 3.41
Ryan Cadenas JR 35181 16 Olathe 3.45 Caleb Berkovsky SR 3711 24 Leominster 3.51 David
Tramontano SR 38229 24 Murrieta 3.51 Molly Atkins JR 27698 15 Des 3.54 Matthew Leake SO
49468 19 Mesa 3.55 Andrew Zinah SR 88135 22 Odessa 3.55 James Seunsom SO 42143 21
Richmond 3.58 Hailee Ferrel FR 72275 20 Layton 3.63 Jonathan Quintanilla SO 79343 16
Howell 3.69 Chandrima Bryant SR 64898 18 Chicago 3.74 Ryan Al-Nimri FR 53238 16 Mission
3.75 Trey Bolling FR 74843 16 Muskegon 3.79 John Thompson FR 15386 21 Olympia 3.82
Adam Brown SO 76537 21 Fort 3.89 Quinton Johnson SR 56102 20 Winston 3.89 Caleb Dylag
SR 35101 15 Sebastian 3.91 Ching-Jung Labrada SO 48635 20 Aberdeen 3.93 Christopher
Royse FR 8095 22 Anchorage 3.98
Solution
#include
#include
using namespace std;
//student class to capture students data
class Student
{
//instance c=variables for students
public:
string fname;
string lname;
string classs;
int zip;
int age;
string town;
float gpa;
//constructor
Student(string fn,string ln,string c,int z,int a,string h,float g)
{
fname=fn;
lname=ln;
classs=c;
zip=z;
age=a;
town=h;
gpa=g;
}
//default constructor
Student()
{
}
};
//function to read data frm file
//returns no of records read
int readFromFile(Student students[100])
{
int size=0;
string fname,lname,town,classs;
int zip,age;
float gpa;
ifstream myfile ("stDATA.txt");
if (myfile.is_open())
{
getline(myfile,fname);
while ( myfile>>fname )
{
myfile>>lname;
myfile>>classs;
myfile>>zip;
myfile>>age;
myfile>>town;
myfile>>gpa;
students[size]=Student(fname,lname,classs,zip,age,town,gpa);
size++;
}
myfile.close();
}
else cout << "Unable to open file";
return size;
}
//display student read
void display(Student students[],int size)
{
cout<<" NamettCLASSt ZIPt AGEt HomeTownt GPA";
for(int i=0;i students[j].gpa)
{
tmp = students[i];
students[i] = students[j];
students[j] = tmp;
}
//if students gpa match,then compare classifictaion
else
if(students[i].gpa==students[j].gpa)
{
if(students[i].classs >students[j].classs)
{
tmp = students[i];
students[i] = students[j];
students[j] = tmp;
}
//if students gpa and classfictaion match, compare lname
else
if(students[i].classs == students[j].classs)
{
if(students[i].lname >students[j].lname)
{
tmp = students[i];
students[i] = students[j];
students[j] = tmp;
}
// f students gpa and classfictaion and lname match, compare fname
else
if(students[i].lname == students[j].lname)
{
if(students[i].fname >students[j].fname)
{
tmp = students[i];
students[i] = students[j];
students[j] = tmp;
}
// if students gpa and classfictaion and lname and fname match it emans it's a
duplkictae record
//set a flag to identify it
else
if(students[i].fname ==students[j].fname)
{
students[j].fname="Duplicate";
}
}
}
}
}
}
//sort
}
//main fucntion which triggers
int main()
{
Student students[100];
int size=readFromFile(students);
sort(students,size);
display(students,size);
cout<

More Related Content

Similar to Program 24 Sorting Students Write a C++ program that will open a.pdf

League table web 09
League table web 09League table web 09
League table web 09mickbrown60
 
Web format league results 15-11
Web format   league results 15-11Web format   league results 15-11
Web format league results 15-11mickbrown60
 
League table web 03
League table web 03League table web 03
League table web 03mickbrown60
 
Web format league results 15-12
Web format   league results 15-12Web format   league results 15-12
Web format league results 15-12mickbrown60
 
Web format league results 15-13
Web format   league results 15-13Web format   league results 15-13
Web format league results 15-13mickbrown60
 
League table web final
League table web finalLeague table web final
League table web finalmickbrown60
 
League table web 08
League table web 08League table web 08
League table web 08mickbrown60
 
Web format league results 15-9
Web format   league results 15-9Web format   league results 15-9
Web format league results 15-9mickbrown60
 
Web format league results 15-9
Web format   league results 15-9Web format   league results 15-9
Web format league results 15-9mickbrown60
 
Web format league results 15-10
Web format   league results 15-10Web format   league results 15-10
Web format league results 15-10mickbrown60
 
Baseball Metrics and player
Baseball Metrics and playerBaseball Metrics and player
Baseball Metrics and playerKristi Karkut
 
Angelo State Baseball (Fall World Series)
Angelo State Baseball (Fall World Series)Angelo State Baseball (Fall World Series)
Angelo State Baseball (Fall World Series)AngeloStateSports
 
Web format league results 15-14
Web format   league results 15-14Web format   league results 15-14
Web format league results 15-14mickbrown60
 
League table web 05
League table web 05League table web 05
League table web 05mickbrown60
 
Web format league results 15 -1
Web format   league results 15 -1Web format   league results 15 -1
Web format league results 15 -1mickbrown60
 
NCAA Division III South/Southeast Men’s Cross Country Championships
NCAA Division III South/Southeast Men’s Cross Country Championships NCAA Division III South/Southeast Men’s Cross Country Championships
NCAA Division III South/Southeast Men’s Cross Country Championships UTTylerPatriots
 
Web format league results 15-6
Web format   league results 15-6Web format   league results 15-6
Web format league results 15-6mickbrown60
 
Ff1 2020 01_results
Ff1 2020 01_resultsFf1 2020 01_results
Ff1 2020 01_resultsmickbrown60
 

Similar to Program 24 Sorting Students Write a C++ program that will open a.pdf (20)

League table web 09
League table web 09League table web 09
League table web 09
 
Web format league results 15-11
Web format   league results 15-11Web format   league results 15-11
Web format league results 15-11
 
League table web 03
League table web 03League table web 03
League table web 03
 
Web format league results 15-12
Web format   league results 15-12Web format   league results 15-12
Web format league results 15-12
 
Web format league results 15-13
Web format   league results 15-13Web format   league results 15-13
Web format league results 15-13
 
REGIONAL TRACK RANKINGS
REGIONAL TRACK RANKINGSREGIONAL TRACK RANKINGS
REGIONAL TRACK RANKINGS
 
League table web final
League table web finalLeague table web final
League table web final
 
League table web 08
League table web 08League table web 08
League table web 08
 
Web format league results 15-9
Web format   league results 15-9Web format   league results 15-9
Web format league results 15-9
 
Web format league results 15-9
Web format   league results 15-9Web format   league results 15-9
Web format league results 15-9
 
Web format league results 15-10
Web format   league results 15-10Web format   league results 15-10
Web format league results 15-10
 
Baseball Metrics and player
Baseball Metrics and playerBaseball Metrics and player
Baseball Metrics and player
 
Angelo State Baseball (Fall World Series)
Angelo State Baseball (Fall World Series)Angelo State Baseball (Fall World Series)
Angelo State Baseball (Fall World Series)
 
Web format league results 15-14
Web format   league results 15-14Web format   league results 15-14
Web format league results 15-14
 
League table web 05
League table web 05League table web 05
League table web 05
 
Web format league results 15 -1
Web format   league results 15 -1Web format   league results 15 -1
Web format league results 15 -1
 
Scores 4 18 15
Scores 4 18 15Scores 4 18 15
Scores 4 18 15
 
NCAA Division III South/Southeast Men’s Cross Country Championships
NCAA Division III South/Southeast Men’s Cross Country Championships NCAA Division III South/Southeast Men’s Cross Country Championships
NCAA Division III South/Southeast Men’s Cross Country Championships
 
Web format league results 15-6
Web format   league results 15-6Web format   league results 15-6
Web format league results 15-6
 
Ff1 2020 01_results
Ff1 2020 01_resultsFf1 2020 01_results
Ff1 2020 01_results
 

More from ezzi97

Explain why multiple processes cannot share data easilySolution.pdf
Explain why multiple processes cannot share data easilySolution.pdfExplain why multiple processes cannot share data easilySolution.pdf
Explain why multiple processes cannot share data easilySolution.pdfezzi97
 
executive summary for law enforcement using dronesSolutionUse .pdf
executive summary for law enforcement using dronesSolutionUse .pdfexecutive summary for law enforcement using dronesSolutionUse .pdf
executive summary for law enforcement using dronesSolutionUse .pdfezzi97
 
Discuss how your life and experience with social mediaweb 2.0 compa.pdf
Discuss how your life and experience with social mediaweb 2.0 compa.pdfDiscuss how your life and experience with social mediaweb 2.0 compa.pdf
Discuss how your life and experience with social mediaweb 2.0 compa.pdfezzi97
 
create a narrative budget blueprint for a local unit of government. .pdf
create a narrative budget blueprint for a local unit of government. .pdfcreate a narrative budget blueprint for a local unit of government. .pdf
create a narrative budget blueprint for a local unit of government. .pdfezzi97
 
define three types of kernal-mode to user mode transfersSolution.pdf
define three types of kernal-mode to user mode transfersSolution.pdfdefine three types of kernal-mode to user mode transfersSolution.pdf
define three types of kernal-mode to user mode transfersSolution.pdfezzi97
 
Arrange the steps of DNA replication in the order that they occur. D.pdf
Arrange the steps of DNA replication in the order that they occur.  D.pdfArrange the steps of DNA replication in the order that they occur.  D.pdf
Arrange the steps of DNA replication in the order that they occur. D.pdfezzi97
 
C++You will design a program to play a simplified version of war, .pdf
C++You will design a program to play a simplified version of war, .pdfC++You will design a program to play a simplified version of war, .pdf
C++You will design a program to play a simplified version of war, .pdfezzi97
 
(c) After conducting several measurements, the Beijing Municipal Env.pdf
(c) After conducting several measurements, the Beijing Municipal Env.pdf(c) After conducting several measurements, the Beijing Municipal Env.pdf
(c) After conducting several measurements, the Beijing Municipal Env.pdfezzi97
 
1. Which of the following statements would correctly print out t.pdf
1. Which of the following statements would correctly print out t.pdf1. Which of the following statements would correctly print out t.pdf
1. Which of the following statements would correctly print out t.pdfezzi97
 
2.How important is it to involve physicians in financial improvement.pdf
2.How important is it to involve physicians in financial improvement.pdf2.How important is it to involve physicians in financial improvement.pdf
2.How important is it to involve physicians in financial improvement.pdfezzi97
 
Write one page essay to explain how you relate signals and systems t.pdf
Write one page essay to explain how you relate signals and systems t.pdfWrite one page essay to explain how you relate signals and systems t.pdf
Write one page essay to explain how you relate signals and systems t.pdfezzi97
 
Why do IDPs & IDRs lack structure Lack a ligand or partner Denatu.pdf
Why do IDPs & IDRs lack structure  Lack a ligand or partner  Denatu.pdfWhy do IDPs & IDRs lack structure  Lack a ligand or partner  Denatu.pdf
Why do IDPs & IDRs lack structure Lack a ligand or partner Denatu.pdfezzi97
 
Write 2 to 3 paragraphs aboutONE DDoS attack that occurred in 2016.pdf
Write 2 to 3 paragraphs aboutONE DDoS attack that occurred in 2016.pdfWrite 2 to 3 paragraphs aboutONE DDoS attack that occurred in 2016.pdf
Write 2 to 3 paragraphs aboutONE DDoS attack that occurred in 2016.pdfezzi97
 
Why is methyl salicylate not appreciably soluble in waterSoluti.pdf
Why is methyl salicylate not appreciably soluble in waterSoluti.pdfWhy is methyl salicylate not appreciably soluble in waterSoluti.pdf
Why is methyl salicylate not appreciably soluble in waterSoluti.pdfezzi97
 
Who are stakeholders Define who they are and then please share what.pdf
Who are stakeholders Define who they are and then please share what.pdfWho are stakeholders Define who they are and then please share what.pdf
Who are stakeholders Define who they are and then please share what.pdfezzi97
 
What was the biggest problem with the Articles of Confederation They.pdf
What was the biggest problem with the Articles of Confederation They.pdfWhat was the biggest problem with the Articles of Confederation They.pdf
What was the biggest problem with the Articles of Confederation They.pdfezzi97
 
What is UWIN and what does it doSolutionUWin is a software .pdf
What is UWIN and what does it doSolutionUWin is a software .pdfWhat is UWIN and what does it doSolutionUWin is a software .pdf
What is UWIN and what does it doSolutionUWin is a software .pdfezzi97
 
What sort of archaeological remains have been discovered on the site.pdf
What sort of archaeological remains have been discovered on the site.pdfWhat sort of archaeological remains have been discovered on the site.pdf
What sort of archaeological remains have been discovered on the site.pdfezzi97
 
Link to assignment that I need help with is below httpweb.cse..pdf
Link to assignment that I need help with is below httpweb.cse..pdfLink to assignment that I need help with is below httpweb.cse..pdf
Link to assignment that I need help with is below httpweb.cse..pdfezzi97
 
The Food Stamp Program is Americas first line of defense against hu.pdf
The Food Stamp Program is Americas first line of defense against hu.pdfThe Food Stamp Program is Americas first line of defense against hu.pdf
The Food Stamp Program is Americas first line of defense against hu.pdfezzi97
 

More from ezzi97 (20)

Explain why multiple processes cannot share data easilySolution.pdf
Explain why multiple processes cannot share data easilySolution.pdfExplain why multiple processes cannot share data easilySolution.pdf
Explain why multiple processes cannot share data easilySolution.pdf
 
executive summary for law enforcement using dronesSolutionUse .pdf
executive summary for law enforcement using dronesSolutionUse .pdfexecutive summary for law enforcement using dronesSolutionUse .pdf
executive summary for law enforcement using dronesSolutionUse .pdf
 
Discuss how your life and experience with social mediaweb 2.0 compa.pdf
Discuss how your life and experience with social mediaweb 2.0 compa.pdfDiscuss how your life and experience with social mediaweb 2.0 compa.pdf
Discuss how your life and experience with social mediaweb 2.0 compa.pdf
 
create a narrative budget blueprint for a local unit of government. .pdf
create a narrative budget blueprint for a local unit of government. .pdfcreate a narrative budget blueprint for a local unit of government. .pdf
create a narrative budget blueprint for a local unit of government. .pdf
 
define three types of kernal-mode to user mode transfersSolution.pdf
define three types of kernal-mode to user mode transfersSolution.pdfdefine three types of kernal-mode to user mode transfersSolution.pdf
define three types of kernal-mode to user mode transfersSolution.pdf
 
Arrange the steps of DNA replication in the order that they occur. D.pdf
Arrange the steps of DNA replication in the order that they occur.  D.pdfArrange the steps of DNA replication in the order that they occur.  D.pdf
Arrange the steps of DNA replication in the order that they occur. D.pdf
 
C++You will design a program to play a simplified version of war, .pdf
C++You will design a program to play a simplified version of war, .pdfC++You will design a program to play a simplified version of war, .pdf
C++You will design a program to play a simplified version of war, .pdf
 
(c) After conducting several measurements, the Beijing Municipal Env.pdf
(c) After conducting several measurements, the Beijing Municipal Env.pdf(c) After conducting several measurements, the Beijing Municipal Env.pdf
(c) After conducting several measurements, the Beijing Municipal Env.pdf
 
1. Which of the following statements would correctly print out t.pdf
1. Which of the following statements would correctly print out t.pdf1. Which of the following statements would correctly print out t.pdf
1. Which of the following statements would correctly print out t.pdf
 
2.How important is it to involve physicians in financial improvement.pdf
2.How important is it to involve physicians in financial improvement.pdf2.How important is it to involve physicians in financial improvement.pdf
2.How important is it to involve physicians in financial improvement.pdf
 
Write one page essay to explain how you relate signals and systems t.pdf
Write one page essay to explain how you relate signals and systems t.pdfWrite one page essay to explain how you relate signals and systems t.pdf
Write one page essay to explain how you relate signals and systems t.pdf
 
Why do IDPs & IDRs lack structure Lack a ligand or partner Denatu.pdf
Why do IDPs & IDRs lack structure  Lack a ligand or partner  Denatu.pdfWhy do IDPs & IDRs lack structure  Lack a ligand or partner  Denatu.pdf
Why do IDPs & IDRs lack structure Lack a ligand or partner Denatu.pdf
 
Write 2 to 3 paragraphs aboutONE DDoS attack that occurred in 2016.pdf
Write 2 to 3 paragraphs aboutONE DDoS attack that occurred in 2016.pdfWrite 2 to 3 paragraphs aboutONE DDoS attack that occurred in 2016.pdf
Write 2 to 3 paragraphs aboutONE DDoS attack that occurred in 2016.pdf
 
Why is methyl salicylate not appreciably soluble in waterSoluti.pdf
Why is methyl salicylate not appreciably soluble in waterSoluti.pdfWhy is methyl salicylate not appreciably soluble in waterSoluti.pdf
Why is methyl salicylate not appreciably soluble in waterSoluti.pdf
 
Who are stakeholders Define who they are and then please share what.pdf
Who are stakeholders Define who they are and then please share what.pdfWho are stakeholders Define who they are and then please share what.pdf
Who are stakeholders Define who they are and then please share what.pdf
 
What was the biggest problem with the Articles of Confederation They.pdf
What was the biggest problem with the Articles of Confederation They.pdfWhat was the biggest problem with the Articles of Confederation They.pdf
What was the biggest problem with the Articles of Confederation They.pdf
 
What is UWIN and what does it doSolutionUWin is a software .pdf
What is UWIN and what does it doSolutionUWin is a software .pdfWhat is UWIN and what does it doSolutionUWin is a software .pdf
What is UWIN and what does it doSolutionUWin is a software .pdf
 
What sort of archaeological remains have been discovered on the site.pdf
What sort of archaeological remains have been discovered on the site.pdfWhat sort of archaeological remains have been discovered on the site.pdf
What sort of archaeological remains have been discovered on the site.pdf
 
Link to assignment that I need help with is below httpweb.cse..pdf
Link to assignment that I need help with is below httpweb.cse..pdfLink to assignment that I need help with is below httpweb.cse..pdf
Link to assignment that I need help with is below httpweb.cse..pdf
 
The Food Stamp Program is Americas first line of defense against hu.pdf
The Food Stamp Program is Americas first line of defense against hu.pdfThe Food Stamp Program is Americas first line of defense against hu.pdf
The Food Stamp Program is Americas first line of defense against hu.pdf
 

Recently uploaded

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

Program 24 Sorting Students Write a C++ program that will open a.pdf

  • 1. Program 24 "Sorting Students" Write a C++ program that will open a file named stDATA.txt. This file contains an unknown number of student records, one per line. The total number of records will be less than or equal to 100. Your program should print a list of students sorted by GPA. If two students have the same GPA they should be sub-sorted by classification (SR, JR, SO, FR). If two students have the same GPA and the same classification, they should be sub- sorted by last name. If two students have the same GPA, classification, and last name they should be sub-sorted by first name. If two students have the same GPA, classification, last name and first name, the second student's record should not be printed; instead the message: "I THINK THIS IS A DUPLICATE RECORD" should be printed. [edit]Deliverables main.cpp prog24Functions.h prog24Functions.cpp Sample data file: FirstName LastName CLASS ZIP AGE HomeTown GPA Hailee Ferrel FR 72275 20 Layton 3.63 Perry Caldwell-Reed SO 4164 19 Racine 2.96 Andrew Dawson JR 39123 21 Huntington 2.29 William Senser SR 15886 25 Fontana 2.14 Shelby Santiago FR 57021 23 Winter 3.15 Matthew Brannon SO 54064 18 Santa 3.35 Christopher Kou JR 31907 22 Monroe 2.36 Cassidy Monjaras SR 41928 24 Jefferson 2.13 Lauren Shah FR 65008 23 Visalia 2.66 Jonathan Quintanilla SO 79343 16 Howell 3.69 Andrew Chen JR 86176 18 Brownsville 3.32 Brendel Unruh SR 37743 20 Lansing 2.48 Christopher Royse FR 8095 22 Anchorage 3.98 Jose Harrison SO 33128 17 Greenville 2.09 Alexander Seiford JR 96517 16 Greenville 2.88 Quinton Johnson SR 56102 20 Winston 3.89 Tristan Gardner FR 74489 21 Brighton 2.22 Alexander Motz SO 49195 24 Cathedral 3.13 Molly Atkins JR 27698 15 Des 3.54 William Savells SR 17951 19 Shreveport 3.16 Shawn Wilcoxen FR 86284 21 Syracuse 3.11 Austin Hardy SO 73491 15 Birmingham 2.52 Jason Ammons JR 94515 22 Atlanta 2.86 Phillip Dutta SR 19503 19 Milwaukee 2.34 Wesley Elliott FR 8885 17 Eugene 2.64 Alexander Childers SO 55503 17 Thornton 2.76 Cameron Jones JR 77131 20 New 2.56 Jessica Louis SR 66868 24 Asheville 3.41 Ryan Kliphon FR 6054 16 Kissimmee 3.26 Zachariah Qureshi SO 18845 19 Harlingen 2.65 Ryan Cadenas JR 35181 16 Olathe 3.45 Chandrima Bryant SR 64898 18 Chicago 3.74 Doraliz Hansen FR 30588 23 Boston 2.61 Alonso Greer SO 94115 20 Victorville 3.19 David Llamas JR 84133 19 Hesperia 2.54 Caleb Dylag SR 35101 15 Sebastian 3.91 Rachel Zust FR 42196 16 Westminster 2.74 Tyler DeRosa SO 14421 19 Westminster 3.21 Kendall Sedate JR 43036 22 Moreno 2.29 Matthew Ortiz-Vitali SR 14801 22 Cary 2.03 Ryan Al-Nimri FR 53238 16 Mission 3.75 Daniel Dratz SO 59534 22 Mission 2.83 Weston Gage JR 56011 18 Macon 2.43 Asad Riggins SR 67131 25 Macon 2.06 John Thompson FR 15386 21 Olympia 3.82 James Seunsom SO 42143 21 Richmond 3.58 Corbin Bodden JR 32787 16 Provo 2.96 Allison Veselka SR 99047 21 Wilmington 3.35 Shawn Renton FR 74027 24 Fort 2.21 Michael Martin SO 74146 16 Bryan 2.82 Austin Huizinga JR 49494 15 Leominster 3.35 Caleb Berkovsky SR 3711 24 Leominster 3.51 Taylor Brown FR 69305 24 Kailua 2.18
  • 2. Elizabeth Taylor SO 54950 17 Tempe 2.95 Alexandra Itskin JR 35943 16 Denver 3.12 Reagan Zipoy SR 3892 16 Pomona 2.70 Edgar Leblanc FR 52703 22 Riverside 3.12 Brian Stevens SO 93293 23 Nashua 3.26 Sam Pearson JR 69161 17 Danbury 3.14 Colin Peterson SR 77027 24 Gulfport-Biloxi 2.72 Diana Sharpe FR 65253 22 Palmdale 3.35 Ching-Jung Labrada SO 48635 20 Aberdeen 3.93 Roberto Haddad JR 69486 19 Escondido 2.70 Mahlet Shifflet SR 82554 15 Appleton 3.32 Parker Miller FR 93219 20 South 2.32 Matthew Leake SO 49468 19 Mesa 3.55 Corey McBrayer JR 71592 18 Santa 2.45 David Tramontano SR 38229 24 Murrieta 3.51 John Rundquist FR 78321 16 Clarke 2.42 Caroline Christenberry SO 42590 24 Poughkeepsie 3.04 Ashley Thomas JR 86691 17 Louisville 2.95 Kyle Andras SR 43291 25 Bakersfield 2.62 Trey Bolling FR 74843 16 Muskegon 3.79 Adam Brown SO 76537 21 Fort 3.89 Michael Handley JR 58339 19 Lancaster 2.29 Andrew Zinah SR 88135 22 Odessa 3.55 Shawn Wilcoxen FR 86284 21 Syracuse 3.11 Austin Hardy SO 73491 15 Birmingham 2.52 Jason Ammons JR 94515 22 Atlanta 2.86 Phillip Dutta SR 19503 19 Milwaukee 2.34 Wesley Elliott FR 8885 17 Eugene 2.64 Phillip Dutta SR 19503 19 Milwaukee 2.34 Wesley Elliott FR 8885 17 Eugene 2.64 Diana Sharpe FR 65253 22 Palmdale 3.35 Diana Sharpe FR 65253 22 Palmdale 3.35 Diana Sharpe FR 65253 22 Palmdale 3.35 Sample Output: First Name Last Name Class Zip Age HomeTown GPA Matthew Ortiz-Vitali SR 14801 22 Cary 2.03 Asad Riggins SR 67131 25 Macon 2.06 Jose Harrison SO 33128 17 Greenville 2.09 Cassidy Monjaras SR 41928 24 Jefferson 2.13 William Senser SR 15886 25 Fontana 2.14 Taylor Brown FR 69305 24 Kailua 2.18 Shawn Renton FR 74027 24 Fort 2.21 Tristan Gardner FR 74489 21 Brighton 2.22 Andrew Dawson JR 39123 21 Huntington 2.29 Michael Handley JR 58339 19 Lancaster 2.29 Kendall Sedate JR 43036 22 Moreno 2.29 Parker Miller FR 93219 20 South 2.32 Phillip Dutta SR 19503 19 Milwaukee 2.34 I THINK THIS IS A DUPLICATE RECORD I THINK THIS IS A DUPLICATE RECORD Christopher Kou JR 31907 22 Monroe 2.36 John Rundquist FR 78321 16 Clarke 2.42 Weston Gage JR 56011 18 Macon 2.43 Corey McBrayer JR 71592 18 Santa 2.45 Brendel Unruh SR 37743 20 Lansing 2.48 Austin Hardy SO 73491 15 Birmingham 2.52 I THINK THIS IS A DUPLICATE RECORD David Llamas JR 84133 19 Hesperia 2.54 Cameron Jones JR 77131 20 New 2.56 Doraliz Hansen FR 30588 23 Boston 2.61 Kyle Andras SR 43291 25 Bakersfield 2.62 Wesley Elliott FR 8885 17 Eugene 2.64 I THINK THIS IS A DUPLICATE RECORD I THINK THIS IS A DUPLICATE RECORD Zachariah Qureshi SO 18845 19 Harlingen 2.65 Lauren Shah FR 65008 23 Visalia 2.66 Roberto Haddad JR 69486 19 Escondido 2.70 Reagan Zipoy SR 3892 16 Pomona 2.70 Colin Peterson SR 77027 24 Gulfport-Biloxi 2.72 Rachel Zust FR 42196 16 Westminster 2.74 Alexander Childers SO 55503 17 Thornton 2.76 Michael Martin SO 74146 16 Bryan 2.82 Daniel Dratz SO 59534 22 Mission 2.83 Jason Ammons JR 94515 22 Atlanta 2.86 I THINK THIS IS A DUPLICATE RECORD Alexander Seiford JR 96517 16 Greenville 2.88 Ashley Thomas JR 86691 17 Louisville 2.95 Elizabeth Taylor SO 54950 17 Tempe 2.95 Corbin
  • 3. Bodden JR 32787 16 Provo 2.96 Perry Caldwell-Reed SO 4164 19 Racine 2.96 Caroline Christenberry SO 42590 24 Poughkeepsie 3.04 Shawn Wilcoxen FR 86284 21 Syracuse 3.11 I THINK THIS IS A DUPLICATE RECORD Edgar Leblanc FR 52703 22 Riverside 3.12 Alexandra Itskin JR 35943 16 Denver 3.12 Alexander Motz SO 49195 24 Cathedral 3.13 Sam Pearson JR 69161 17 Danbury 3.14 Shelby Santiago FR 57021 23 Winter 3.15 William Savells SR 17951 19 Shreveport 3.16 Alonso Greer SO 94115 20 Victorville 3.19 Tyler DeRosa SO 14421 19 Westminster 3.21 Ryan Kliphon FR 6054 16 Kissimmee 3.26 Brian Stevens SO 93293 23 Nashua 3.26 Andrew Chen JR 86176 18 Brownsville 3.32 Mahlet Shifflet SR 82554 15 Appleton 3.32 Diana Sharpe FR 65253 22 Palmdale 3.35 I THINK THIS IS A DUPLICATE RECORD I THINK THIS IS A DUPLICATE RECORD I THINK THIS IS A DUPLICATE RECORD Austin Huizinga JR 49494 15 Leominster 3.35 Matthew Brannon SO 54064 18 Santa 3.35 Allison Veselka SR 99047 21 Wilmington 3.35 Jessica Louis SR 66868 24 Asheville 3.41 Ryan Cadenas JR 35181 16 Olathe 3.45 Caleb Berkovsky SR 3711 24 Leominster 3.51 David Tramontano SR 38229 24 Murrieta 3.51 Molly Atkins JR 27698 15 Des 3.54 Matthew Leake SO 49468 19 Mesa 3.55 Andrew Zinah SR 88135 22 Odessa 3.55 James Seunsom SO 42143 21 Richmond 3.58 Hailee Ferrel FR 72275 20 Layton 3.63 Jonathan Quintanilla SO 79343 16 Howell 3.69 Chandrima Bryant SR 64898 18 Chicago 3.74 Ryan Al-Nimri FR 53238 16 Mission 3.75 Trey Bolling FR 74843 16 Muskegon 3.79 John Thompson FR 15386 21 Olympia 3.82 Adam Brown SO 76537 21 Fort 3.89 Quinton Johnson SR 56102 20 Winston 3.89 Caleb Dylag SR 35101 15 Sebastian 3.91 Ching-Jung Labrada SO 48635 20 Aberdeen 3.93 Christopher Royse FR 8095 22 Anchorage 3.98 Solution #include #include using namespace std; //student class to capture students data class Student { //instance c=variables for students public: string fname; string lname;
  • 4. string classs; int zip; int age; string town; float gpa; //constructor Student(string fn,string ln,string c,int z,int a,string h,float g) { fname=fn; lname=ln; classs=c; zip=z; age=a; town=h; gpa=g; } //default constructor Student() { } }; //function to read data frm file //returns no of records read int readFromFile(Student students[100]) { int size=0; string fname,lname,town,classs; int zip,age; float gpa; ifstream myfile ("stDATA.txt"); if (myfile.is_open()) {
  • 5. getline(myfile,fname); while ( myfile>>fname ) { myfile>>lname; myfile>>classs; myfile>>zip; myfile>>age; myfile>>town; myfile>>gpa; students[size]=Student(fname,lname,classs,zip,age,town,gpa); size++; } myfile.close(); } else cout << "Unable to open file"; return size; } //display student read void display(Student students[],int size) { cout<<" NamettCLASSt ZIPt AGEt HomeTownt GPA"; for(int i=0;i students[j].gpa) { tmp = students[i]; students[i] = students[j]; students[j] = tmp; } //if students gpa match,then compare classifictaion else if(students[i].gpa==students[j].gpa) { if(students[i].classs >students[j].classs) { tmp = students[i]; students[i] = students[j];
  • 6. students[j] = tmp; } //if students gpa and classfictaion match, compare lname else if(students[i].classs == students[j].classs) { if(students[i].lname >students[j].lname) { tmp = students[i]; students[i] = students[j]; students[j] = tmp; } // f students gpa and classfictaion and lname match, compare fname else if(students[i].lname == students[j].lname) { if(students[i].fname >students[j].fname) { tmp = students[i]; students[i] = students[j]; students[j] = tmp; } // if students gpa and classfictaion and lname and fname match it emans it's a duplkictae record //set a flag to identify it else if(students[i].fname ==students[j].fname) { students[j].fname="Duplicate"; } } } } }
  • 7. } //sort } //main fucntion which triggers int main() { Student students[100]; int size=readFromFile(students); sort(students,size); display(students,size); cout<