i have done a bit for my project. my project is about student portal where students can register and log in to check their result over the semester. but i'm having some problems. i was instructed to use structure, function, file processing, array, pointer. the problem is that after i registered as a student, i cannot log in. can someone help me with this problem. btw, im finish the project yet and if you have any idea to add in my project, i would like to hear it. thanks and sorry for my bad english
struct Info
{
string name;
char ic[15]; //identification card no
int matrik;
};
Info student;
Info RegisterStudent();
Info Student_Menu();
void LoginStudent();
void LoginAdmin();
int main()
{
int menu;
do{
cout << "1. REGISTER AS STUDENTS\n";
cout << "2. LOG IN AS STUDENT\n";
cout << "3. LOG IN AS ADMIN\n";
cout << "4. EXIT\n";
cout << "ENTER YOUR CHOICE:";
cin >> menu;
system("CLS");
Info RegisterStudent() //for student to register
{
ofstream outStudentInfo("students.dat",ios::out);
if(!outStudentInfo)
{
cerr << "FILE COULD NOT BE OPENED" << endl;
exit(1);
}
cout << "ENTER YOUR NAME:";
cin.ignore();
getline(cin,student.name);
cout << "ENTER YOUR IC NUMBER:";
cin >> student.ic;
cout << "ENTER YOUR MATRIK CARD NUMBER:";
cin >> student.matrik;
outStudentInfo << student.name << "\t";
outStudentInfo << student.ic << "\t";
outStudentInfo << student.matrik << "\n";
system("CLS");
}
void LoginStudent() //in this function, user will enter the id and password to log in
{
int id,x;
char passstudent[15];
cout << "ENTER YOUR ID(MATRIK NO.):";
cin >> id;
cout << "ENTER YOUR PASSWORD(IC):";
cin >> passstudent;