0% found this document useful (0 votes)
538 views

Diploma in Computer Technology: Government Polytechnic, Solapur

This document is a micro-project report submitted by student Sharaneshwar Bharat Punjal for their Object Oriented Programming Using C++ course. The report details a Student Attendance Management System developed using C++. The system allows users to create an attendance sheet by importing student details from a source file. It also allows adding attendance for a particular date by marking students as present or absent based on a submitted file of present or absent roll numbers. The project utilizes various C++ concepts like classes, objects, functions and file handling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
538 views

Diploma in Computer Technology: Government Polytechnic, Solapur

This document is a micro-project report submitted by student Sharaneshwar Bharat Punjal for their Object Oriented Programming Using C++ course. The report details a Student Attendance Management System developed using C++. The system allows users to create an attendance sheet by importing student details from a source file. It also allows adding attendance for a particular date by marking students as present or absent based on a submitted file of present or absent roll numbers. The project utilizes various C++ concepts like classes, objects, functions and file handling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Maharashtra Board of Technical Education, Mumbai

GOVERNMENT POLYTECHNIC,
SOLAPUR

DIPLOMA IN COMPUTER TECHNOLOGY


ACADEMIC YEAR 2021-22

OBJECT ORIENTED PROGRAMMING USING


C++
(22316)
A
MICRO-PROJECT REPORT
ON

STUDENT ATTENDANCE MANAGEMENT SYSTEM

Submitted by:
Roll No. 82 – Sharaneshwar Bharat Punjal

Submitted to:
Prof. A. P. Sathe

1
CERTIFICATE

This is to certify that the following student Sharaneshwar Bharat

Punjal, Roll No. 82 of Branch CM3I of the institute Government Polytechnic,

Solapur (0015) has completed the micro-project work satisfactorily under my

supervision/guidance for the subject Object Oriented Programming Using C+

+ (22316) in the academic year 2020-2021 as prescribed in the curriculum.

Project guide H.O.D Principal


(Prof. A. P. Sathe) (Mr. A.L. Tarange) (Mr. S.K. Hunasimarad)

ACKNOWLEDGEMENT
In the accomplishment of this micro-project successfully, many people
have best owned upon me their blessings and heart-privileged support.
Primarily, I would like to express a special thanks of gratitude to the Principal

2
Sir of the Government Polytechnic, Solapur for giving this golden opportunity
with all the required facilities for completing this micro-project of our group.

I would like to extend my gratitude to our OOP subject teacher, Prof. A.


P. Sathe sir, whose valuable guidance has been the ones that helped us patch
this project and make it full proof success. Their suggestions and instructions
has served as the major contributor towards the completion of the micro-project.

I would also like to thank my parents who have helped with their valuable
suggestions and provided the required resources needed for the micro-project.

3
ABSTRACT
As a student enrolled in the Government Polytechnic, Solapur, every
semester we require to do a micro-project on any one topic in the syllabus of the
respective subjects. Hence, I have done a micro-project to develop a Student
Attendance Management System using C++.

This micro-project mainly highlights the object oriented programming of


C++. It includes concepts like classes, objects, functions and most importantly,
file handling. The project mainly focuses on file handling in C++ and it
performs functions like creating an attendance sheet and adding each day’s
attendance to the file.

The micro-project is made in such a way that it is a user-friendly and is


easy to navigate between all the functions of this system. Hoping that the
readers would feel it productive and knowledgeable. Any suggestions for the
improvement of this Management System are sincerely appreciated.

4
INTRODUCTION
As said earlier, this micro-project mainly shows the implementation of
file handling in C++. It includes functions like create_sheet() which is used for
creating new attendance sheet which includes roll numbers and names of all the
students of the particular class. This data is copied into a new attendance sheet.
Next function of the system is add_attendance() which is used to add the
attendance of particular date in the file. The user has to input a file which
contains the present roll numbers of that particular day. With the help of that
present roll numbers file, the attendance sheet gets updated by placing a ‘P’ for
present or ‘A’ for absent in front of the respective students. The user also has to
choice to input present roll numbers file or absent roll numbers file and
depending upon the user’s input, the attendance gets marked in the sheet.
This is how the student attendance system works. The input and output of
the program can be seen on the content that gets updated in the files. For this
attendance system, all the files are of .csv extension as these type of files are
very suitable for storing the attendance of the students.

5
REVIEW OF CONCEPTS
A short review of the important concepts of C++ used in this micro-
project is here.

1. OBJECT-ORIENTED PROGRAMMING –
Object-oriented programming aims to implement real-world entities like
inheritance, hiding, polymorphism, etc. in programming. The main aim of OOP
is to bind together the data and the functions that operate on them so that no
other part of the code can access this data except that function. Classes and
objects are the basic building blocks of OOP.

2. FILE HANDLING -
In C++, files are mainly dealt by using three classes fstream, ifstream,
ofstream available in fstream headerfile.
ofstream: Stream class to write on files
ifstream: Stream class to read from files
fstream: Stream class to both read and write from/to files.
We can open and close files using open() and close() functions or
constructors present in fstream classes.
Default open modes:
ifstream – ios::in
ofstream – ios::out
fstream – ios::in | ios::out

6
 SIGNIFICANCE OF THE PROJECT -
The main significance of this micro-project is to develop C++ programs using
file handling. This project clearly shows how file handling is implemented in
C++ and particularly its shows how to read and write .csv files.

 SCOPE OF THE PROJECT -


Many concepts of C++ are involved in this project like classes, objects,
functions and file handling. But, this system mainly focuses on file handling
concept of C++. It would be a very good example of how files can be read and
written in C++.

 HARDWARE REQUIREMENTS -
Laptop or PC or Mobile with Basic Configurations.

 SOFTWARE REQUIREMENTS -
1. Operating System (Windows family)
2. IDE for C++ language (Turbo C++, Visual Studio Code, Dev C++, etc.)
3. Text Editor

7
C PROGRAM CODE
#include <iostream>
#include <fstream>
#include <conio.h>
#include <time.h>
using namespace std;

void heading();
void delay(int milliseconds);

class Attendance
{
    ifstream fin;
    ofstream fout;
    string sheetfile, sourcefile;
    int total;
    const string p = "P", a = "A";

public:
    void create_sheet()
    {
        heading();
        cout << "Enter file name of the attendance sheet -> ";
        cin >> sheetfile;
        cout << endl
             << "Enter file name (.csv) to import students roll no.s
and names -> ";
        cin >> sourcefile;

        // Fetching total students into the source file


        total = fetch_total_students_from_file(sourcefile);

        // Fetching student details from source file...


        string rollno[total], name[total];
        fetch_student_details_from_file(sourcefile, total, rollno,
name);

        // Fetching data into attendance sheet...


        fout.open(sheetfile + ".csv");
        fout << "Roll No.,Name of Student" << endl;

8
        for (int i = 0; i < total; i++)
        {
            fout << rollno[i] << "," << name[i] << endl;
        }
        fout.close();
        cout << endl
             << "Fetching data from file into the attendance sheet";
        for (int i = 0; i < 3; i++)
        {
            delay(700);
            cout << ".";
        }
        delay(500);
        heading();
        cout << "Successfully fetched the student details into " <<
sheetfile << ".csv file..." << endl;
        getch();
    }

    void fetch_student_details_from_file(string filename, int total,


string *rollno, string *name)
    {
        fin.open(filename + ".csv");
        for (int i = 0, j = 0; fin.good(); i++)
        {
            string line;
            if (i % 2 == 0)
            {
                getline(fin, line, ',');
                rollno[j] = line;
            }
            else
            {
                getline(fin, line, '\n');
                name[j] = line;
                j++;
            }
        }
        fin.close();
    }

    int fetch_total_students_from_file(string filename)


    {

9
        int total = 0;
        fin.open(filename + ".csv");
        while (fin.good())
        {
            string line;
            getline(fin, line, '\n');
            total++;
        }
        fin.close();
        return total;
    }

    void add_attendance()
    {
        int total2, choice2;
        string date, presentrolls_filename;
        delay(500);
        heading();
        cout << "Enter file name of the attendance sheet -> ";
        cin >> sheetfile;
        cout << endl
             << "Enter date of attendance -> ";
        cin >> date;
        cout << endl
             << "Enter 1 -> To input present students roll no.s" <<
endl;
        cout << "Enter 2 -> To input absent students roll no.s" <<
endl;
        cout << endl
             << "Enter your choice -> ";
        cin >> choice2;
        if (choice2 == 1)
        {
            cout << endl
                 << "Enter file name which contains present students
roll no.s -> ";
            cin >> presentrolls_filename;

            total = fetch_total_students_from_file(sheetfile);
            total2 =
fetch_total_students_from_file(presentrolls_filename);

            // Fetching roll no.s and names from sheet

10
            string rollno[total], name[total];
            fetch_student_details_from_file(sheetfile, total,
rollno, name);

            // Fetching data from present rollnos file


            string presentrolls[total2];
            fin.open(presentrolls_filename + ".csv");
            for (int i = 0; i < total2; i++)
            {
                getline(fin, presentrolls[i]);
            }
            fin.close();

            string filedata[total];
            fin.open(sheetfile + ".csv");
            for (int i = 0; i < total; i++)
            {
                getline(fin, filedata[i]);
            }
            fin.close();

            fout.open(sheetfile + ".csv");
            for (int i = 0; i < total; i++)
            {
                if (filedata[i].length() == 0)
                    break;
                else
                {
                    if (i == 0)
                        fout << filedata[i] << "," << date << endl;
                    else
                    {
                        int flag = -1;
                        for (int k = 0; k < total2; k++)
                        {
                            if (rollno[i].compare(presentrolls[k])
== 0)
                            {
                                flag = 1;
                                break;
                            }
                            else
                            {

11
                                flag = 0;
                            }
                        }
                        if (flag == 0)
                            fout << filedata[i] << "," << a << endl;
                        else if (flag == 1)
                            fout << filedata[i] << "," << p << endl;
                        else
                            fout << filedata[i] << endl;
                    }
                }
            }
            fout.close();
        }
        else if (choice2 == 2)
        {
            cout << endl
                 << "Enter file name which contains absent students
roll no.s -> ";
            cin >> presentrolls_filename;

            total = fetch_total_students_from_file(sheetfile);
            total2 =
fetch_total_students_from_file(presentrolls_filename);

            // Fetching roll no.s and names from sheet


            string rollno[total], name[total];
            fetch_student_details_from_file(sheetfile, total,
rollno, name);

            // Fetching data from present rollnos file


            string presentrolls[total2];
            fin.open(presentrolls_filename + ".csv");
            for (int i = 0; i < total2; i++)
            {
                getline(fin, presentrolls[i]);
            }
            fin.close();

            string filedata[total];
            fin.open(sheetfile + ".csv");
            for (int i = 0; i < total; i++)
            {

12
                getline(fin, filedata[i]);
            }
            fin.close();

            fout.open(sheetfile + ".csv");
            for (int i = 0; i < total; i++)
            {
                if (filedata[i].length() == 0)
                    break;
                else
                {
                    if (i == 0)
                        fout << filedata[i] << "," << date << endl;
                    else
                    {
                        int flag = -1;
                        for (int k = 0; k < total2; k++)
                        {
                            if (rollno[i].compare(presentrolls[k])
== 0)
                            {
                                flag = 1;
                                break;
                            }
                            else
                            {
                                flag = 0;
                            }
                        }
                        if (flag == 0)
                            fout << filedata[i] << "," << p << endl;
                        else if (flag == 1)
                            fout << filedata[i] << "," << a << endl;
                        else
                            fout << filedata[i] << endl;
                    }
                }
            }
            fout.close();
        }
        else
        {
            cout << endl

13
                 << "Invalid choice..." << endl
                 << "Enter again..." << endl;
        }
        cout << endl
             << "Marking attendance";
        for (int i = 0; i < 3; i++)
        {
            delay(700);
            cout << ".";
        }
        delay(500);
        heading();
        cout << "Successfully marked attendance of " << date << "
into " << sheetfile << ".csv file..." << endl;
        getch();
    }
};

int main()
{
    int choice;
    Attendance a;
    do
    {
        heading();
        cout << "1 -> Create new attendance sheet" << endl;
        cout << "2 -> Add attendance" << endl;
        cout << "3 -> Exit" << endl
             << endl;
        cout << "Enter your choice -> ";
        cin >> choice;
        switch (choice)
        {
        case 1:
            a.create_sheet();
            break;
        case 2:
            a.add_attendance();
            break;
        case 3:
            cout << endl
                 << "Thank you..." << endl;
            getch();

14
            exit(0);
        default:
            cout << endl
                 << "Invalid choice..." << endl
                 << "Enter again..." << endl;
            getch();
        }
    } while (1);
    return 0;
}

void heading()
{
    system("cls");
    cout << "****** STUDENT ATTENDANCE MANAGEMENT SYSTEM ******" <<
endl;
    cout << "--------------------------------------------------" <<
endl
         << endl;
}

void delay(int milliseconds)


{
    clock_t start_time = clock();
    while (clock() < start_time + milliseconds)
        ;
}

15
PROGRAM OUTPUT
1.
****** STUDENT ATTENDANCE MANAGEMENT SYSTEM ******
--------------------------------------------------

1 -> Create new attendance sheet


2 -> Add attendance
3 -> Exit

Enter your choice -> 1

2.
****** STUDENT ATTENDANCE MANAGEMENT SYSTEM ******
--------------------------------------------------

Enter file name of the attendance sheet -> Attendance_CM3I

Enter file name (.csv) to import students roll no.s and names ->
studentdata

Fetching data from file into the attendance sheet...

3.
****** STUDENT ATTENDANCE MANAGEMENT SYSTEM ******
--------------------------------------------------

Successfully fetched the student details into Attendance_CM3I.csv


file...

4.
****** STUDENT ATTENDANCE MANAGEMENT SYSTEM ******
--------------------------------------------------

1 -> Create new attendance sheet


2 -> Add attendance
3 -> Exit

Enter your choice -> 2

16
5.
****** STUDENT ATTENDANCE MANAGEMENT SYSTEM ******
--------------------------------------------------

Enter file name of the attendance sheet -> Attendance_CM3I

Enter date of attendance -> 15-12-2021

Enter 1 -> To input present students roll no.s


Enter 2 -> To input absent students roll no.s

Enter your choice -> 2

Enter file name which contains absent students roll no.s ->
absentstudents

Marking attendance...

6.
****** STUDENT ATTENDANCE MANAGEMENT SYSTEM ******
--------------------------------------------------

Successfully marked attendance of 15-12-2021 into


Attendance_CM3I.csv file...

7.
****** STUDENT ATTENDANCE MANAGEMENT SYSTEM ******
--------------------------------------------------

1 -> Create new attendance sheet


2 -> Add attendance
3 -> Exit

Enter your choice -> 3

Thank you...

CONCLUSION

17
The main course outcome behind this micro-project was to implement file
handling concept in C++. Hence, after completing this micro-project, we think
that this course outcome is successfully achieved.

This micro-project would really help the users to maintain a proper


attendance sheet for their class. The users who were following the traditional
method of putting ‘P’ for present students and ‘A’ for absent students for every
class but by this program they will just input the present students list and the
sheet automatically gets updated. Hence, this program will be very beneficial
for the users.

Also, considering my point of view, this micro-project helped me to


increase my knowledge about implementation of file handling in C++. It also
helped me to analyze real world problems and produce a solution to it with the
help of my knowledge and skills. Hoping that the readers would use this
program to maintain their attendance sheet in a simple and easy way.

18
REFERENCES
 www.google.com
 www.youtube.com
 www.geeksforgeeks.org
 www.tutorialspoint.com
 www.generalnote.com
 www.javatpoint.com
 www.programiz.com
 www.w3schools.in

19

You might also like