School Manangement
School Manangement
REG. NO:ED201/112855/23
SCHOOL:B.ED.
PROGRAM:PHYSICS/COMPUTER
TITLE: OOP 1
#include<iostream>
#include<string>
#include<cstring>
#include<cctype>
class Student {
private:
int title; // Master = 1, Mr = 2, Miss = 3
std::string studentName;
int rollNo;
std::string fatherName;
std::string motherName;
std::string address;
std::string bloodGroup;
public:
void getDetails(); // Get Student Details from the user
void printDetails(); // Print the details of the Student
};
void Student::getDetails() {
std::cout << "Enter Title (Master = 1, Mr = 2, Miss = 3): ";
do {
std::cin >> title;
} while (title != 1 && title != 2 && title != 3);
std::cin.ignore();
std::cin.ignore();
}
int retRollNo(){ //Return Roll No
return rollNo;
}
char * retString(char x){ //Return all strings available from the Student Class
if(x=='T')
return strTitle(title);
if(x=='N')
return studentName;
if(x=='F')
return fatherName;
if(x=='M')
return motherName;
if(x=='A')
return address;
if(x=='B')
return bloodGroup;
}
char * retStudentName(){ //Returns Student Name
return retString('N');
}
void modDetail(char ch); //Modify Details for Student
};
1. Class Student:
- The Student class is defined with private member variables to store information about a student
such as title, student name, roll number, father's name, mother's name, address, and blood group.
- The class includes public member functions to get student details (getDetails), print student details
(printDetails), return roll number (retRollNo), return a string based on input character (retString),
return student name (retStudentName), and modify details based on input character (modDetail).
2. getDetails() :
- This function prompts the user to input various details of the student such as title, name, roll
number, father's name, mother's name, address, and blood group.
3. printDetails() :
- This function prints out the details of the student in a formatted manner by using the retString
function to convert the title integer to a string representation.
4. retRollNo() :
- This function returns the roll number of the student.
5. retString(char x) :
- This function returns a string based on the input character x, where different characters represent
different fields of student information (e.g., 'T' for title, 'N' for name, 'F' for father's name, etc.).
6. retStudentName() :
- This function returns the student's name by calling retString with the character 'N'.
7. modDetail(char ch) :
- This function is declared but not implemented in the provided code. It is intended to modify
specific details of the student based on the input character ch.