Вы находитесь на странице: 1из 24

LOYOLA SCHOOL, BILASPUR(C.

G)

AN

PROJECT WORK

ON

Student Database Management

SUBMITTED IN PARTIAL FULFILMENT FOR THE AWARD


OF DEGREE.

ALL INDIA SR.SCHOOL CERTIFICATE EXAMINATION

2019-20

SUBMITTED BY:
SUBMITTED TO

Aman Umrao MR.


SUDHIR NAIDU
ROLL NO: (P.G.T
COMPUTER SCIENCE)

STUDENT INTERNAL EXTERNAL


PRINCIPAL

CERTIFICATE

This is to certify that Aman Umrao of class


12th Roll number ,of Loyola School,
Bilaspur (C.G) has satisfactorily completed
the computer science project on C++. I
recommend this project as a part of
fulfilment of annual computer science
practical exam under AISSCE.
As prescribed by CBSE board 2019-20.

Date:
Teacher: Mr. Sudhir Naidu
Pricipal: Fr. Fabianus Minj

Teacher’s signature

ACKNOWLEDGEMENT

I hereby declare that the project work is


completely done by me. As per the CBSE
curriculum of AISSCE 2019-20,under the
guidance of my practical guide Mr Sudhir
Naidu. This project repot contains my
original work. I am thankful to my practical
guide Mr Sudhir Naidu for his technical
support for the completion of this project
work as per AISSCE-2019-20.
I extend my special thanks to Fr. Fabianus
Minj, principal, for his whole hearted
support and blessings.

Aman Umraol

PROJECT ABSTRACT

Today a large number of schools are becoming


modernized with the new technology. Now, they are
not just limited to computer lab but they are also
using computer technology in school’s administration
itself. So our project is a student’s mark sheet
keeping and maintaining software that enables easy
to do functions like adding new record, deleting and
modifying old ones and see existing records with
help of data files in C++.
File handling is crucial for a programmer to make
such a software. C++ offers data file handling with
fstream header. This project uses fstream header and
it’s stream objects to accomplish the above
mentioned tasks with data files. It also does so with
an intutive, interesting, easy to use and colourful user
interface created with our previous knowledge of the
language's basics along with some research on
additional functions. That’s pretty much our project
in a nutshell.

Aman Umrao

HARDWARE REQUIRED

HARD DISK 10MB;


INTEL CORE PROCESSOR;
OUTPUT DEVICE;
INPUT DEVICE QWERTY
KEYBOARD;

SOFTWARE REQUIRED

WINDOWS XP 32-BIT OPREATING


SYSTEM;
C++ LANGUAGE SUPPORTING
COMPILER(CODEBLOCKS);
RAM 10MB;
Project

CODE:
P
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <fstream>
#include <windows.h>
#include <process.h>
using namespace std;
void gotoxy(short x, short y)
{
COORD pos = {x, y};
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
void addrec();
void shoerec();
void delrec();
void modify();
void drawscreen();
void mainmenu();
void input();
void loading2()
{
int w=1,x=0,y,z;
system("color 0a");
float j;
gotoxy(35,9);
system("color 0c");
cout<<"Loading\n";
for(w;w<12;++w)
{
gotoxy(25,11);
for(int i=0;i<w;++i)
{
cout<<char(178);
Sleep(10);
cout<<char(178);
Sleep(10);
cout<<char(178);
Sleep(10);
if(i==9)
break;
}
for(j=0;j<w;++j)
{ gotoxy(43,9);
cout<<" ";
gotoxy(43,9);
cout<<".";
Sleep(200);
cout<<".";
Sleep(200);
cout<<".";
Sleep(200);
if(j==2)
break; ;
}
}
cout<<"\n\n\n\n\n\n";
Sleep(2000);
}
void loading()
{ system("cls");
int w=1,x=0,y,i,z;
float j;
{
gotoxy(24,10);
cout<<char(218);
for(int i=0;i<31;++i)
cout<<char(196);
cout<<char(191);
gotoxy(24,11);
cout<<char(179);
gotoxy(56,11);
cout<<char(179);
gotoxy(24,12);
cout<<char(192);
for(int i=0;i<31;++i)
cout<<char(196);
cout<<char(217);
}
gotoxy(35,9);
system("color 0c");
cout<<"Loading...\n";
for(w;w<32;++w)
{
gotoxy(25,11);
for(i=0;i<w;++i)
{
cout<<char(178);
}
for(j=0;j<w;++j)
{ gotoxy(38,13);
cout<<(j*3.333)<<"%";
;
}

Sleep(50);
} gotoxy(38,13);
cout<<"100%\t\t\n\n\n\n\n\n";
Sleep(2000);
}
class stu
{
int rno;
char name[40], fname[40], mname[40];
char clss[4];
float marks;
char grade;
public : void getdata ();
void putdata ();
int getrno ()
{
return rno;
}
};
void stu::getdata ()
{
gotoxy (7,5);
cout << "Roll number : "; cin >> rno;
gotoxy (7,6);
cout << "Name : "; gets( name);
gotoxy (7,7);
cout << "Father's name: "; gets( fname);
gotoxy (7,8);
cout << "Mother's name: "; gets( mname);
gotoxy (7,9);
cout << "Class : "; gets( clss);
gotoxy (7,10);
cout << "Marks : "; cin >> marks;
if (marks>=80) grade='A';
else if (marks>=70) grade='B';
else if (marks>=60) grade='C';
else if (marks>=50) grade='D';
else if (marks>=40) grade='E';
else grade='F';
gotoxy (7,11);
cout << "Grade : " << grade;
}
void stu::putdata ()
{
gotoxy (7,5);
cout << "Roll number : " << rno;
gotoxy (7,6);
cout << "Name : " << name;
gotoxy (7,7);
cout << "Father's name: " << fname;
gotoxy (7,8);
cout << "Mother's name: " << mname;
gotoxy (7,9);
cout << "Class : " << clss;
gotoxy (7,10);
cout << "Marks : " << marks;
gotoxy (7,11);
cout << "Grade : " << grade;
}
void addrec()
{ loading();
drawscreen();
system("color 0e");
char ch;
stu old, nw;
ofstream fo("temp.dat",ios::out|ios::app|ios::binary);
ifstream fi("stu.dat", ios::in|ios::binary);
char last = 'y';
gotoxy (5,3);
cout << "Enter record of the student :" ;
nw.getdata();
while(!fi.eof())
{
fi.read((char*)&old, sizeof(old));
if(nw.getrno()<=old.getrno())
{
fo.write((char*)&nw, sizeof(nw));
last='n';
break;
}
else
fo.write ((char*)&old, sizeof(old));
}
if (last=='y')
fo.write((char*)&nw, sizeof(nw));
else
while (!fi.eof())
{
fi.read((char*)&old, sizeof(old));
fo.write ((char*)&old, sizeof(old));
}
gotoxy (5,13);
cout << "Record added successfully";
fo.close();
fi.close();
remove ("stu.dat");
rename ("temp.dat", "stu.dat");
gotoxy (5,15);
cout << "Want to add more records ?(y/n)";
ch=getch();
if (ch=='y'||ch=='Y') addrec();
input();
}

void delrec ()
{ loading();
drawscreen();
system("color 0d");
stu s;
ifstream fi ("stu.dat", ios::in| ios::binary);
ofstream fo ("temp.dat", ios::out| ios::binary);
int rn;
char found='f';
char ch='n';
gotoxy (5,3);
cout << "Enter roll number of student";
gotoxy (5,4);
cout << "whose record is to be deleted :";
cin >> rn;
while (!fi.eof())
{
fi.read((char*)&s, sizeof(s));
if (s.getrno()==rn)
{
found='t';
s.putdata();
gotoxy (5,13);
cout << "Are you sure you want to delete";
gotoxy (5,14);
cout << "this record?(y/n) :";
ch=getch();
if (ch =='n')
fo.write((char*)&s, sizeof(s));
}
else
fo.write((char*)&s, sizeof(s));
}
if (found =='f')
{
gotoxy (5,13);
cout << "Record not found!!";
}
else if (ch=='n')
{
gotoxy (1,13);
cout << char(177)<<" Record saved
"<<char(177)<<"\n"
<< " "<<char(177)<<" "<<char(177);
}
else
{
gotoxy (1,13);
cout << char(177)<<" Record deleted sucessfully
"<<char(177)<<"\n"
<< " "<<char(177)<<" "<<char(177);
}
fi.close();
fo.close();
remove ("stu.dat");
rename ("temp.dat", "stu.dat");
gotoxy (5,15);
cout << "Want to delete more records ?(y/n)";
ch=getch();
if (ch=='y'||ch=='Y') delrec();
input();
}

void modify ()
{ loading();
drawscreen();
system("color 0c");
char ch;
stu s;
fstream fio("stu.dat", ios::in| ios::out| ios::binary);
fio.seekg(0);
int rn;
long pos;
char found ='f';
gotoxy (5,3);
cout << "Enter roll number of student whose";
gotoxy (5,4);
cout << " record is to be modified: ";
cin >> rn;
while(!fio.eof())
{
pos=fio.tellp();
fio.read((char*)&s, sizeof(s));
if (s.getrno()==rn)
{
gotoxy (1,3);
cout << char(177)<<" Enter new details:
"<<char(177)<<"\n"
<< " "<<char(177)<<"
"<<char(177);
s.getdata();
fio.seekg(pos);
fio.write((char*)&s, sizeof(s));
found='t';
break;
}
}
if (found=='f')
{
gotoxy (5,6);
cout << "Record not found!!";
}
else
{
gotoxy (5,13);
cout << "Record modified sucessfully";
}
fio.seekg(0);
gotoxy (5,15);
cout << "Want to modify more records ?(y/n)";
ch=getch();
if (ch=='y'||ch=='Y') modify();
input();
}

void showrec()
{ loading();
system("color 0b");
drawscreen();
int rn;
char ch;
stu s;
ifstream fi("stu.dat",ios::in);
gotoxy (5,3);
cout << "Enter roll number of the student : ";
cin >> rn;
char found = 'f';
while(!fi.eof())
{
fi.read((char*)&s, sizeof(s));
if( s.getrno()==rn)
{
found = 't';
s.putdata();
break;
}
}
if (found=='f')
{
gotoxy(5,6);
cout << "Record not found!!";
}
gotoxy (5,15);
cout << "Want to see more record ?(y/n)";
ch=getch();
if (ch=='y'||ch=='Y') showrec();
input();
}

void drawscreen()
{
int a,b,c;
{
system("cls");
system("color 0a");
cout<<char(201);
gotoxy (79,0);
cout<<char(187);
gotoxy (79,23);
cout<<char(188);
gotoxy (0,23);
cout<<char(200);
for(int d=2;d<80;++d)
{ Sleep (10);
for(int f=1,b=78;f<(d);f++,--b)
{
gotoxy (f,0);
cout << char(205);
}
for(int f=1,b=78;f<(d);f++,--b)
{

{ gotoxy (b,23);
cout << char(205);
}
}

for(int f=1,b=78;f<(d);f++,--b)
{
if(f==23)
break;
else
{ gotoxy (79,f);
cout << char(186);
}
}
for(int f=1,b=22;f<(d);f++,--b)
{ if(f==23)
break;
else

{ gotoxy (0,b);
cout << char(186);
}
}
}
}
}
void exio()
{
system("color 09");
system("cls");
gotoxy(35,11);
cout<<"THANK YOU!!\n";
gotoxy(39,12);
cout<<char(1)<<char(1)<<"\n\n\n\n\n\n\n\n";
}
void mainmenu()
{
drawscreen();
gotoxy (8,3);
cout << "STUDENT RESULT DATABASE MANAGEMENT SYSTEM";
gotoxy (12,10);
cout << "S = See result records";
gotoxy (12,12);
cout << "A = Add new record";
gotoxy (12,14);
cout << "M = Modify old record";
gotoxy (12,16);
cout << "D = Delete existing record";
gotoxy (12,18);
cout << "E = Exit";
gotoxy (10,8);
cout << "Press corresponding letter to continue";
gotoxy (7,21);
cout << "Created by "<<char(16)<<" Tushar Agrawal Class 12A";
gotoxy (7,22);
cout << " "<<char(16)<<" Aman Umrao Class 12A";

label:
char ch;
ch = getch();
switch (ch)
{
case 's':
case 'S': system("color 09");showrec(); break;
case 'a':
case 'A': system("color 0b");addrec(); break;
case 'm':
case 'M': system("color 0d");modify(); break;
case 'd':
case 'D': system("color 0e");delrec(); break;
case 'e':
case 'E': exio(); break;
default : goto label;
}
}

void input()
{
gotoxy (5,19);
cout << "Press coressponding key to continue";
gotoxy (9,21);
cout << "M = Mainmenu";
gotoxy (9,22);
cout << "E = Exit";
l:
char ch;
ch=getch();
switch (ch)
{
case 'e':
case 'E': exit(0); break;
case 'm':
case 'M': mainmenu(); break;
default : goto l;
}
}

int main()
{
;
fstream f("stu.dat",ios::out|ios::app);
f.close();
loading2();
mainmenu();
return 0;
}
OUTPUT:

Вам также может понравиться