Create a C++ program that will use a function to perform a bubble sort of an arr
ID: 3626661 • Letter: C
Question
Create a C++ program that will use a function to perform a bubble sort of an array of records.The program should first prompt the user for values to populate an array of 5 grade records each containing 2 fields (i.e., int Grade, int StudentNumber). The program should then call a function to perform a bubble sort to sort the records in the array by the Grade field, and display the sorted records to the user.
Start with the template program.
A sample session:
Please enter grades and student numbers for 5 students:
Please enter a grade:87
Please enter a student number: 10140567
Please enter a grade:77
Please enter a student number: 10111267
Please enter a grade:66
Please enter a student number: 10983645
Please enter a grade:82
Please enter a student number: 11238765
Please enter a grade:70
Please enter a student number: 10546967
Thank you... sorting....
The sorted list is:
Grade Student
66 10983645
70 10546967
77 10111267
82 11238765
87 10140567
What to hand in:
A C++ program named a5q2.cpp containing the C++ program.
Explanation / Answer
Program written in dev-c++. if you are using visual studio include stdafx.h #include using namespace std; class student { public: int grade; long studentno; }; void sortGrades( student s[],int n ){ int i,j; student temp; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.