#include<iostream>
#include<fstream>
#include<string>
usingnamespace std;
#include"Function.h"
//Input data for a student
void inputdata(student &s, ifstream &in)
{
in.getline(s.fullname,100);
in.getline(s.birthday,15);
in.getline(s.mail,100);
in.getline(s.address,128);
}
//Input a list of students
void inputlist(student a[], ifstream &in)
{
in.open("input.txt");
int n, i;
in >> n;
for(i=0;i<n;++i)
{
inputdata(a[i], in);
}
in.close();
}
//Output data of a student
void outputdata(student &s, ofstream &out)
{
out.open("output.txt");
out << "Name: " << s.fullname;
out << "Birthday: " << s.birthday;
out << "Mail: " << s.mail;
out << "Address: " << s.address;
}
does it crash? If that is the case then it is because you are trying to hold wrong type of value in a variable. Eg: If you have written as a string and read as a integer. then it might be a problem. Sometimes due to errors blurry thing gets written to a file. That might also be the reason why it is reading wrong type of variable.