#include<iostream>
#include<string>
#include<fstream>
struct Student
{
long int _StudentRoll;
std::string _Name;
double marks;
void InsertDetails(int i)
{
std::cout << "\n" << i << "th Employee Details: \n";
std::cout << "\nEnter the Student Roll No. : ";
std::cin >> _StudentRoll;
std::cin.ignore();
std::cout << "\nEnter the Student Name: ";
getline(std::cin, _Name);
std::cout << "\nEnter the Marks: ";
std::cin >> marks;
}
void DisplayDetails()
{
std::cout << "\nStudent ID-: " << _StudentRoll;
std::cout << "\nStudent Name-: " << _Name;
std::cout << "\nStudent Address-: " << marks;
}
};
int main()
{
int _numberOfStudent;
std::cout << "\nEnter the Number of Students: ";
std::cin >> _numberOfStudent;
Student* _StudentObject = new Student[_numberOfStudent];
for (int i = 0; i < _numberOfStudent; i++)
{
_StudentObject[i].InsertDetails(i);
}
std::cout << "\nNOW DISPLAYING THE DETAILS OF THE Students\n";
ofstream f1("Student.txt", ios::app);
for (int i = 0; i < _numberOfStudent; i++)
{
f1 <<"Student Roll: "<< _StudentObject[i]._StudentRoll << std::endl;
f1 <<"Student Name: "<< _StudentObject[i]._Name << std::endl;
f1 <<"Student Marks: "<< _StudentObject[i].marks << std::endl;
_StudentObject[i].DisplayDetails();
}
}