CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2007
    Posts
    2

    attendance monitoring system

    here i post my coding.i have to do the attendance monitoring system for student in dev c++.actually,i have done half of the coding,but now i'm stuck already.i don't know how to do the key in attendance and viewing the attendance student.can sumone help me?

    help me!!!!i really need some helps~!



    #include<iostream>
    #include<string>
    #include<cstring>
    #include<cstdlib>
    #include<iomanip>
    #include<fstream>

    using namespace std;

    int menu_utama();
    int exit();

    class Student {

    private:
    string id;
    string password;
    string name;
    string email;
    string faculty;
    string dir,dir1;
    string subject[ ];
    string storege;

    public:
    int Student_Menu();
    void Student_Information();
    void Student_Login();
    void Student_New();
    };
    //------------------------------------------------------------------------------
    int Student::Student_Menu()
    {
    Student s;
    int option;


    cout<<" *****************************************************"<<endl;
    cout<<" -----------ATTENDANCE MONITORING SYSTEM--------------"<<endl;
    cout<<" * [ ==STUDENT MENU== ] *"<<endl;
    cout<<" * *"<<endl;
    cout<<" * [1] LOG IN *"<<endl;
    cout<<" * [2] REGISTER(FOR NEW STUDENT) *"<<endl;
    cout<<" * [3] MAIN MENU *"<<endl;
    cout<<" * [4] EXIT *"<<endl;
    cout<<" * *"<<endl;
    cout<<" *****************************************************"<<endl;
    cout<<" Enter a selection : ";
    cin>>option;

    switch(option)
    {
    case 1:
    system("cls");
    s.Student_Login();
    break;
    case 2:
    system("cls");
    s.Student_New();
    break;
    case 3:
    system("cls");
    menu_utama();
    break;
    case 4:
    system("cls");
    exit();
    break;

    }
    }
    //------------------------------------------------------------------------------
    void Student::Student_Login()
    {
    Student s;
    fstream readfile;

    cout<<" *****************************************************"<<endl;
    cout<<" -----------ATTENDANCE MONITORING SYSTEM--------------"<<endl;
    cout<<" * [ ==STUDENT LOG IN== ] *"<<endl;
    cout<<endl;
    cout<<" Please enter your user id and password : "<<endl<<endl;
    cout<<" USER ID[STUDENT ID] : ";
    cin>>id;
    cout<<endl;
    cout<<" PASSWORD : ";
    cin>>password;
    cout<<endl;

    cout<<"\t\tChecking password for "<<id<<"..."<<endl;
    cout<<endl;

    dir = "Data/" + id + ".txt";
    readfile.open(dir.c_str(),ios::in);

    if (readfile.fail())
    {
    cerr<<"\t\tError reading file"<<endl;
    cout<<endl;
    system("pause");
    Student_New();
    }
    else
    {
    while(!readfile.eof())
    {
    if (!readfile.eof())
    {
    getline(readfile,storege,'\n');
    getline(readfile,storege,'#');

    if(storege == id)
    {
    getline(readfile,storege,'\t');
    getline(readfile,storege,'#');
    if(storege == password)
    {
    s.Student_Information();
    break;
    }
    }
    else
    {
    getline(readfile,storege,'#');
    getline(readfile,storege,'#');
    getline(readfile,storege,'\n');
    }
    }
    if (readfile.eof())
    {
    cerr<<"\t\tUser does not exist"<<endl;
    cout<<endl;
    system("pause");
    Student_New();
    }
    }
    }

    readfile.close();
    }
    //------------------------------------------------------------------------------
    void Student::Student_New()
    {

    Student s;
    int n;
    string id;
    string password;
    string name;
    string confirm_password;
    string email;
    string faculty;
    string subject[7];
    char ans;
    string dir = "none";


    fstream ffile;

    cout<<" *****************************************************"<<endl;
    cout<<" -----------ATTENDANCE MONITORING SYSTEM--------------"<<endl;
    cout<<" * [ ==STUDENT REGISTER== ] *"<<endl;
    cout<<endl;
    cout<<" -----------REGISTER FORM(FOR NEW STUDENT)------------"<<endl;
    cout<<endl;
    cout<<" Please enter your personal details below : "<<endl<<endl;
    cout<<" Enter your user id[student id] : ";
    cin>>id;
    cout<<endl;
    cout<<" Enter your name : ";
    cin.ignore();
    getline(cin, name);
    /*cin>>name;*/
    cout<<endl;
    cout<<" Enter your password : ";
    cin>>password;
    cout<<endl;



    while(password!=confirm_password)
    {
    cout<<" Re-enter your password : ";
    cin>>confirm_password;
    cout<<endl;
    }

    cout<<" Enter your e-mail : ";
    cin.ignore();
    getline(cin,email);
    cout<<endl;
    cout<<" Enter your faculty : ";
    //cin.ignore();
    getline(cin,faculty);
    cout<<endl;
    cout<<" Enter how many subject that you are taking for this "<<endl;
    cout<<" semester : ";
    cin>>n;
    cout<<endl;
    for(int i=1; i<=n; i++)
    {
    cout<<" Enter your subject "<< i <<" : ";
    cin.ignore();
    getline(cin, subject[i]);
    cout<<endl;
    }

    dir = "Data/" +id+ ".txt";

    ffile.open(dir.c_str(),ios:ut | ios::app);

    ffile<<endl<<id<<"#\t"<<password<<"#\t"<<name<<"#\t "<<confirm_password<<"#\t"<<email<<"#\t"<<faculty<<"#\t"<<endl;
    for(int i=1; i<=n; i++)
    {

    ffile<<subject[i]<<"#\t"<<endl;
    }
    ffile<<endl;
    ffile.close();

    cout<<endl;
    cout<<" All your information have been save! "<<endl;
    cout<<endl;
    cout<<endl;
    cout<<" Do you want to log in? [Y]es [N]o : ";
    cin>>ans;
    cout<<endl;

    if(ans == 'Y' || ans == 'y')
    {
    system("cls");
    s.Student_Login();
    }
    else
    {
    system("cls");
    s.Student_Menu();
    }


    }
    //---------------------------------------------------------------------------------------------------------
    void Student::Student_Information()
    {
    int option;

    cout<<" *******************************************************"<<endl;
    cout<<" -----------ATTENDANCE MONITORING SYSTEM----------------"<<endl;
    cout<<" * [ ==STUDENT INFORMATION== ] *"<<endl;
    cout<<" * *"<<endl;
    cout<<" * WELCOME (........................................) *"<<endl;
    cout<<" * TO THE ATTENDENCE MONITORING SYSTEM *"<<endl;
    cout<<" * *"<<endl;
    cout<<" * You can choose the menu below for using this system.*"<<endl;
    cout<<" * *"<<endl;
    cout<<" * [1] VIEW STUDENT DETAILS *"<<endl;
    cout<<" * [2] VIEW ATTENDENCE FOR SUBJECT *"<<endl;
    cout<<" * [3] MAIN MENU *"<<endl;
    cout<<" * *"<<endl;
    cout<<" *******************************************************"<<endl;
    cout<<" Enter a selection : ";
    cin>>option;
    }
    //----------------------------------------------------------------------------
    class Lecture {

    private:
    string id;
    string name;
    string password;
    string confirm_password;
    string dir1;
    string store;
    public:
    int Lecture_Menu();
    void Lecture_Information();
    void Lecture_Login();
    void Lecture_New();
    };
    //------------------------------------------------------------------------------
    int Lecture::Lecture_Menu()
    {
    Lecture l;
    int option;


    cout<<" ******************************************************"<<endl;
    cout<<" -----------ATTENDANCE MONITORING SYSTEM---------------"<<endl;
    cout<<" * [ ==LECTURER MENU== ] *"<<endl;
    cout<<" * *"<<endl;
    cout<<" * [1] LOG IN *"<<endl;
    cout<<" * [2] REGISTER(FOR NEW LECTURER) *"<<endl;
    cout<<" * [3] MAIN MENU *"<<endl;
    cout<<" * [4] EXIT *"<<endl;
    cout<<" * *"<<endl;
    cout<<" ******************************************************"<<endl;
    cout<<" Enter a selection : ";
    cin>>option;

    switch(option)
    {
    case 1:
    system("cls");
    l.Lecture_Login();
    break;
    case 2:
    system("cls");
    l.Lecture_New();
    break;
    case 3:
    system("cls");
    menu_utama();
    break;
    case 4:
    system("cls");
    exit();
    break;

    }
    }
    //--------------------------------------------------------------------------------------------------
    void Lecture::Lecture_Login()
    {
    Lecture l;
    fstream lecfile;
    char ans;

    cout<<" *****************************************************"<<endl;
    cout<<" -----------ATTENDANCE MONITORING SYSTEM--------------"<<endl;
    cout<<" * [ ==LECTURER LOG IN== ] *"<<endl;
    cout<<endl;
    cout<<" Please enter your user id and password : "<<endl<<endl;
    cout<<" USER ID[LECTURER ID] : ";
    cin>>id;
    cout<<endl;
    cout<<" PASSWORD : ";
    cin>>password;
    cout<<endl;
    cout<<"\t\tChecking password for "<<id<<"..."<<endl;
    cout<<endl;

    dir1 = "Data/" + id + ".txt";
    lecfile.open(dir1.c_str(),ios::in);

    if (lecfile.fail())
    {
    cerr<<"\t\tError reading file"<<endl;
    cout<<endl;
    cout<<" Do you want to Log in again (Y/N)? " ;
    cin>>ans;
    if(ans == 'Y' || ans == 'y')
    {
    system("cls");
    l.Lecture_Login();
    }
    else
    {
    system("cls");
    l.Lecture_Menu();
    }

    }
    else
    {
    while(!lecfile.eof())
    {
    if (!lecfile.eof())
    {
    getline(lecfile,store,'\n');
    getline(lecfile,store,'#');

    if(store == id)
    {
    getline(lecfile,store,'\t');
    getline(lecfile,store,'#');
    if(store == password)
    {
    system("cls");
    l.Lecture_Information();
    break;
    }
    }
    else
    {
    getline(lecfile,store,'#');
    getline(lecfile,store,'#');
    getline(lecfile,store,'\n');
    }
    }
    if (lecfile.eof())
    {
    cerr<<"\t\tUser does not exist"<<endl;
    cout<<endl;

    }
    }
    }

    lecfile.close();
    }
    //-------------------------------------------------------------------------------
    void Lecture::Lecture_New()
    {
    Lecture l;
    string id;
    string name;
    string password;
    string confirm_password;
    char ans;
    string dir1 = "none";


    fstream lecfile;

    cout<<" *****************************************************"<<endl;
    cout<<" -----------ATTENDANCE MONITORING SYSTEM--------------"<<endl;
    cout<<" * [ ==LECTURER REGISTER== ] *"<<endl;
    cout<<endl;
    cout<<" -----------REGISTER FORM(FOR NEW LECTURER)------------"<<endl;
    cout<<endl;
    cout<<" Please enter your personal details below : "<<endl<<endl;
    cout<<" Enter your user id[lecturer id] : ";
    cin>>id;
    cout<<endl;
    cout<<" Enter your name : ";
    cin.ignore();
    getline(cin, name);
    cout<<endl;
    cout<<" Enter your password : ";
    cin>>password;
    cout<<endl;

    while(password!=confirm_password)
    {
    cout<<" Re-enter your password : ";
    cin>>confirm_password;
    cout<<endl;
    }

    dir1 = "Data/" +id+ ".txt";
    lecfile.open(dir1.c_str(),ios:ut | ios::app);

    lecfile<<endl<<id<<"#\t"<<password<<"#\t"<<name<<"#\t"<<confirm_password<<"#\t"<<endl;
    lecfile<<endl;
    lecfile.close();

    cout<<endl;
    cout<<" All your information have been save! "<<endl;
    cout<<endl;
    cout<<" Do you want to log in? [Y]es [N]o : ";
    cin>>ans;
    cout<<endl;

    if(ans == 'Y' || ans == 'y')
    {
    system("cls");
    l.Lecture_Login();
    }
    else
    {
    system("cls");
    l.Lecture_Menu();
    }


    }
    //-------------------------------------------------------------------------------------------
    void Lecture::Lecture_Information()
    {
    int option;

    cout<<" *******************************************************"<<endl;
    cout<<" -----------ATTENDANCE MONITORING SYSTEM----------------"<<endl;
    cout<<" * [ ==LECTURER INFORMATION== ] *"<<endl;
    cout<<" * *"<<endl;
    cout<<" * WELCOME (........................................) *"<<endl;
    cout<<" * TO THE ATTENDENCE MONITORING SYSTEM *"<<endl;
    cout<<" * *"<<endl;
    cout<<" * You can choose the menu below for using this system.*"<<endl;
    cout<<" * *"<<endl;
    cout<<" * [1] KEYING STUDENT ATTENDANCE *"<<endl;
    cout<<" * [2] CALCULATE THE OVERALL PERCENTAGE OF ABSENTEEISM*"<<endl;
    cout<<" * [3] MAIN MENU *"<<endl;
    cout<<" * *"<<endl;
    cout<<" *******************************************************"<<endl;
    cout<<" Enter a selection : ";
    cin>>option;
    }
    //-------------------------------------------------------------------------------------
    int exit()
    {
    return exit();
    }
    //-------------------------------------------------------------------------------------
    int menu_utama()
    {
    int option;
    Student s;
    Lecture l;

    cout<<" *****************************************************"<<endl;
    cout<<" -----------ATTENDANCE MONITORING SYSTEM--------------"<<endl;
    cout<<" * [ ==MAIN MENU== ] *"<<endl;
    cout<<" * *"<<endl;
    cout<<" * [1] LECTURER *"<<endl;
    cout<<" * [2] STUDENT *"<<endl;
    cout<<" * [3] EXIT *"<<endl;
    cout<<" * *"<<endl;
    cout<<" *****************************************************"<<endl;



    cout<<" Enter option: ";
    cin>>option;



    switch(option)


    {
    case 1:
    system("cls");
    l.Lecture_Menu();
    break;
    case 2:
    system("cls");
    s.Student_Menu();
    break;
    case 3:
    exit();
    break;
    }
    return menu_utama();
    }
    //-------------------------------------------------------------------------------
    int main()
    {
    menu_utama();

    system("pause");
    return 0;

    }

  2. #2
    Join Date
    Oct 2000
    Location
    London, England
    Posts
    4,773

    Re: attendance monitoring system

    there are some problems. This is not legal syntax:
    Code:
    string subject[ ];
    It is not a good idea to stick exit() in the middle of function as a means of normal termination. Let your code terminate through the bottom of main.
    Why has Lecture_Menu declared a local instance?

  3. #3
    Join Date
    Jul 2007
    Posts
    2

    Unhappy Re: attendance monitoring system

    owh.i put string subject[7]; there.
    aaa.did anyone have idea how to do the view n key in the attendance?

  4. #4
    Join Date
    Jul 2007
    Posts
    2

    Re: attendance monitoring system

    you have a problem in this line

    ffile.open(dir.c_str(),iosut | ios::app);

    can you fix it now

  5. #5
    Join Date
    Jul 2007
    Posts
    2

    Re: attendance monitoring system

    you have small error here

    int exit ()
    {
    return exit ;
    }

    it should be

    int exit()
    {
    exit(-1);
    }

  6. #6
    Join Date
    Jan 2013
    Location
    Largo, FL.
    Posts
    356

    Re: attendance monitoring system

    michaelmackay - ALL Companies are concerned about monitoring absences of their employees. And as you know - ALL Companies currently have some sort of method to track it.

    The best app I ever saw was an Excel Spreadsheet. It showed all 12 months of the year and all 365 days.... A supervisor could see at a glance when employees called in sick 10 times and it was always a Friday and or Monday. (oldest trick in the book)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured