School Managment System
School Managment System
B24F1260AI050
Shahyan Khan
b24f1000ai276
M rabee
b24f1204ai002
Aeman awais
b24f0897ai007
#include <iostream>
#include <string>
using namespace std;
struct Student {
int rollNo;
string name;
int age;
string grade;
};
int main() {
Student students[MAX_STUDENTS];
int studentCount = 0;
int choice;
do {
cout << "\n===== School Management System =====" << endl;
cout << "1. Add Student" << endl;
cout << "2. View All Students" << endl;
cout << "3. Search Student by Roll Number" << endl;
cout << "4. Exit" << endl;
cout << "Enter your choice: ";
cin >> choice;
switch (choice) {
case 1:
addStudent(students, studentCount);
break;
case 2:
viewStudents(students, studentCount);
break;
case 3:
searchStudent(students, studentCount);
break;
case 4:
cout << "Exiting the program. Goodbye!" << endl;
break;
default:
cout << "Invalid choice. Please try again." << endl;
}
} while (choice != 4);
return 0;
}
void addStudent(Student students[], int &count) {
if (count >= MAX_STUDENTS) {
cout << "Error: Cannot add more students. Maximum limit reached." << endl;
return;
}
count++;
cout << "Student added successfully!" << endl;
}
int rollNo;
cout << "\nEnter Roll Number to search: ";
cin >> rollNo;
cout << "Student with Roll Number " << rollNo << " not found." << endl;
}