C++ Assessment
A WORK REPORT SUBMITTED
IN PARTIAL FULLFILLMENT OF THE REQUIREMENT FOR THE DEGREE
Bachelors of Computer Application
Dezyne E’cole College
106/10, CIVIL LINES
AJMER
RAJASTHAN - 305001 (INDIA)
www.dezyneecole.com
TOPIC: Student Management System
SUBMITTED BY:
POOJA SHARMA
BCA 2nd YEAR
Acknowledgement
I Pooja Sharma student of Dezyne E’cole College, extremely grateful to each
and every individual who has contributed in successful completion of my
project.
I express my gratitude towards Dezyne E’cole College to their guidelines
and constant supervision as well as for providing the necessary information
and support regarding the completion of project.
Thanks.
Synopsis
This project is a minor project made based on practical concepts of C++. This
project has made our basic practical concepts strong.
OUTPUT:
CODING:
#include<iostream.h>
#include<iomanip.h>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<fstream.h>
class file
{
public:
char n[20],c[20],t[10],id[10];
void getdata()
{
clrscr();
gotoxy(30,10);
cout<<"Enter ID:";
cin>>id;
gotoxy(30,11);
cout<<"Enter name:";
cin>>n;
gotoxy(30,12);
cout<<"Enter class:";
cin>>c;
gotoxy(30,13);
cout<<"Enter city:";
cin>>t;
}
void store(file f)
{
fstream fp;
fp.open("stu.txt",ios::app);
fp.write((char*)&f,sizeof(f));
cout<<" Data Stored";
}
void show()
{
clrscr();
file f;
fstream fp;
fp.open("stu.txt",ios::in);
while(fp.read((char*)&f,sizeof(f)))
{
cout<<f.id<<"n"<<f.n<<"n"<<f.c<<"n"<<f.t;
}
}
void datamodi()
{
clrscr();
fstream fp;
file f,m;
clrscr();
cout<<"Enter your id:";
cin>>id;
fstream md;
fp.open("stu.txt",ios::in);
md.open("abc.txt",ios::out);
while(fp.read((char*)&f,sizeof(f)))
{
if(strcmp(f.id,id)==0)
{
strcpy(m.id,id);
cout<<"Enter student name::";
cin>>m.n;
cout<<"Enter student class";
cin>>m.c;
cout<<"Enter student city:";
cin>>m.t;
md.write((char*)&m,sizeof(m));
}
else
{
md.write((char*)&m,sizeof(f));
}
}
md.close();
fp.close();
remove("stu.txt");
rename("abc.txt","stu.txt");
}
void search()
{
file f;
int c=0;
fstream fp;
fp.open("stu.txt",ios::in);
cout<<"Enter your ID::";
cin>>id;
while(fp.read((char*)&f,sizeof(f)))
{
if(strcmp(id,f.id)==0)
{
cout<<f.id<<"n"<<f.n<<"n"<<f.c<<"n"
<<f.t<<endl; c++;
break;
}
}
if(c==0)
{
cout<<"Data not found";
}
}
void datadelete()
{
clrscr();
fstream fp;
file f,m;
cout<<"Enter your id:";
cin>>id;
fstream md;
fp.open("stu.txt",ios::in);
md.open("abc.txt",ios::out);
while(fp.read((char*)&f,sizeof(f)))
{
if(strcmp(f.id,id)==0)
{
}
else
{
md.write((char*)&f,sizeof(f));
}
}
md.close();
fp.close();
remove("stu.txt");
rename("abc.txt","stu.txt");
}
};
void main()
{
file w;
clrscr();
int x=1,y=1;
for(int i=0;i<25;i++)
{
gotoxy(x,y);
cout<<"*";
x++;
}
x=2,y=1;
for(i=0;i<78;i++)
{
gotoxy(x,y);
cout<<"*";
x++;
}
x=79,y=1;
for(i=0;i<25;i++)
{
gotoxy(x,y);
cout<<"*";
y++;
}
x=78,y=25;
for(i=0;i<78;i++)
{
gotoxy(x,y);
cout<<"*";
x--;
}
gotoxy(25,8);
cout<<"Welcome to student management sysytem"<<endl;
textcolor(4);
gotoxy(30,10);
cout<<"1.";
cprintf("A");
cout<<"dd student";
gotoxy(30,11);
cout<<"2.";
cprintf("S");
cout<<"how student";
gotoxy(30,12);
cout<<"3.";
cprintf("S");
cout<<"earch student";
gotoxy(30,13);
cout<<"4.";
cprintf("M");
cout<<"odify student";
gotoxy(30,14);
cout<<"5.";
cprintf("D");
cout<<"elete student";
gotoxy(30,15);
cout<<"6.";
cprintf("E");
cout<<"xit";
gotoxy(27,17);
cout<<"Enter your choice..";
char ch;
cin>>ch;
if(ch=='1')
{
clrscr();
gotoxy(30,10);
w.getdata();
w.store(w);
getch();
main();
}
else if(ch=='2')
{
clrscr();
gotoxy(30,10);
w.show();
getch();
main();
}
else if(ch=='3')
{
clrscr();
gotoxy(30,10);
w.search();
getch();
main();
}
else if(ch=='4')
{
clrscr();
gotoxy(30,20);
w.datamodi();
getch();
main();
}
else if(ch=='5')
{
clrscr();
gotoxy(30,10);
w.datadelete();
getch();
main();
}
else if(ch=='6')
{
exit(0);
}
else
{
main();
}
}
THANK YOU
Submitted By:
Pooja Sharma
BCA 2nd Year
Dezyne E’cole College

Pooja Sharma , BCA Third Year