#include"header.h"
int main()
{
int roll_number;
string name;
time_t in_time = time(0);
//user input
cout<<"\nenter Roll Number of student: -";
cin>>roll_number;
cout<<"\nenter name of student: -";
cin>>name;
cout<<"\nArrival time of the Student is : ="<<ctime(&in_time)<<endl;
//File write operation
ofstream fileinput;
fileinput.open("student.txt", ios::app);
fileinput<<"Student"<<", "<< roll_number <<", "<< name <<", "<< ctime(&in_time);
fileinput.close();
cout << "\nRecord Added Successfully\n";
return 0;
}
student.txt
Student, 2002, Tom, Tue Jan 25 11:32:07 2022
Student, 5443, Samuel, Tue Jan 25 11:32:29 2022