practical part 1
practical part 1
Assignment No.1
Problem Statement:- Consider a student database of SEIT class (at least 15 records). Database
contains different fields of every student like Roll No, Name and SGPA.(array of structure)
a) Design a roll call list, arrange list of students according to roll numbers in ascending order (Use
Bubble Sort)
*/
#include <iostream>
#include <string>
#define SIZE 5
struct student {
int roll_no;
string name;
float SGPA;
};
cout << "Enter roll number, name, and SGPA for " << SIZE << " students:\n";
cout << list[i].roll_no << "\t" << list[i].name << "\t" << list[i].SGPA << "\n";
int i, j;
student temp;
temp = list[j];
list[j + 1] = temp;
int main() {
student list[SIZE];
accept(list);
display(list);
bubble_sort(list);
cout << "\nSorted List:\n";
display(list);
return 0;
Output=
Enter roll number, name, and SGPA for 5 students:
Student 1:
Student 2:
Student 3:
Student 4:
Student 5:
Original List:
105 Tejas 8
Sorted List:
105 Tejas 8