This document describes a C++ program that generates name lists. It includes the coding for the main functions like inserting, viewing, modifying, deleting, and searching student records stored in a text file. The program uses classes, file handling functions, and switch cases to provide a menu-driven interface for performing the different operations on student data. It provides sample outputs to demonstrate how the program works and displays the records before and after various operations.
2. Partial Fulfillment
On
C++ Programming
At
Dezyne E’cole College
Submitted to
Dezyne E’cole College
Dezyne E’cole College
106/10, Civil Lines Ajmer
Tel-Phone - 0145-2624679
www.dezyneecole.com
2016-2017
3. Acknowledgement
I HARDIK JADAM STUDENT OF DEZYNE E’COLE COLLEGE, AN
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 FOR PROVIDING THE NECESSARY
INFORMATION AND SUPPORT REGARDING THE COMPLETION
OF PROJECT.
Thank you
4. Synopsis
THIS PROJECT IS A MINOR PROJECT MADE BASED ON
PRACTICAL CONCEPTS OF C++. THIS PROJECT HAS MADE
OUR BASIC PRACTICAL CONCEPTS STRONG.
5. P a g e | 1
Name List Generator
Coding:-
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
#include<fstream.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
class var
{
public:
char n[20],c[20],l[20];
char id[20];
6. P a g e | 2
};
var w,in;
fstream u;
fstream f;
void main()
{
class file
{
public:
void bor()
{
int i;
for(i=2;i<79;i++)
{
gotoxy(i,3);
cout<<"-";
gotoxy(i,4);
cout<<"-";
gotoxy(i,22);
cout<<"-";
gotoxy(i,23);
cout<<"-";
}
for(i=2;i<=24;i++)
{
gotoxy(5,i);
cout<<"|";
gotoxy(6,i);
cout<<"-";
gotoxy(7,i);
cout<<"|";
gotoxy(74,i);
7. P a g e | 3
cout<<"|";
gotoxy(75,i);
cout<<"-";
gotoxy(76,i);
cout<<"|";
}
}
void con()
{
char c;
gotoxy(20,20);
textcolor(4);
cprintf("C");
textcolor(7);
cout<<"ontinue";
gotoxy(39,20);
textcolor(4);
cprintf("B");
cout<<"ack";
gotoxy(55,20);
textcolor(4);
cprintf("E");
textcolor(7);
cout<<"xit";
c=getch();
switch(c)
{
case 'c':
case 'C':
clrscr();
get();
case 'b':
8. P a g e | 4
case 'B':
clrscr();
main();
case 'E':
case 'e':
exit(0);
}
}
void op()
{
bor();
char c;
gotoxy(30,6);
cout<<"NAME LIST GENERATOR";
textcolor(4);
gotoxy(22,10);
cprintf("I");
textcolor(7);
cout<<"nsert Student";
gotoxy(44,10);
textcolor(4);
cprintf("V");
textcolor(7);
cout<<"iew Student";
gotoxy(22,12);
textcolor(4);
cprintf("D");
textcolor(7);
cout<<"elete Student";
gotoxy(44,12);
textcolor(4);
9. P a g e | 5
cprintf("M");
textcolor(7);
cout<<"odify Student";
gotoxy(22,14);
textcolor(4);
cprintf("S");
textcolor(7);
cout<<"earch Student";
gotoxy(44,14);
textcolor(4);
cprintf("E");
textcolor(7);
cout<<"xit";
c=getch();
switch(c)
{
case 'i' :
case 'I' :
clrscr();
get();
break;
case 'v':
case 'V':
clrscr();
view();
break;
case 'd':
case 'D':
clrscr();
del();
break;
case 'm':
10. P a g e | 6
case 'M' :
clrscr();
mod();
break;
case 's':
case 'S' :
clrscr();
search();
break;
case 'e':
case 'E':
exit(0);
default: cout<<"Wrong Input";
main();
break;
}
}
11. P a g e | 7
Insert Student Detail
View Inserted Record
13. P a g e | 9
gets(in.c);
add();
con();
}
void add()
{
f.open("std",ios::out | ios::app);
f.write((char *) &in,sizeof(in));
f.close();
gotoxy(27,16);
cout<<"Record INSERTED";
}
14. P a g e | 10
View all Records
Coding:-
void view()
{
bor();
gotoxy(30,6);
cout<<"VIEW all Records";
gotoxy(20,8);
cout<<"Id"<<"t"<<"Name"<<"tt"<<"Class"<<"t"<<"City"<<endl;
f.open("std",ios::in);
gotoxy(20,9);
while(f.read((char *) &in,sizeof(in)))
{
cout<<in.id<<"t"<<in.n<<"t"<<in.l<<"t"<<in.c<<endl<<"tt ";
if(f==0)
{
break;
15. P a g e | 11
}
}
f.close();
char c;
gotoxy(20,20);
textcolor(4);
cprintf("B");
cout<<"ack";
gotoxy(55,20);
textcolor(4);
cprintf("E");
textcolor(7);
cout<<"xit";
bor();
c=getch();
switch(c)
{
case 'b':
case 'B':
clrscr();
main();
case 'E':
case 'e':
exit(0);
}
}
16. P a g e | 12
Modify Student Detail
Before Modify
17. P a g e | 13
After Modify
Coding:-
void mod()
{
char aid[5];
bor();
gotoxy(25,6);
cout<<"MODIFY Student Detail";
gotoxy(25,8);
cout<<"Enter id::";
cin>>aid;
f.open("std",ios::in);
u.open("temp",ios::app);
while(f.read((char *) &in,sizeof(in)))
{
if(strcmp(in.id,aid)==0)
{
19. P a g e | 15
textcolor(4);
cprintf("E");
textcolor(7);
cout<<"xit";
c=getch();
switch(c)
{
case 'c':
case 'C':
clrscr();
mod();
case 'b':
case 'B':
clrscr();
main();
case 'E':
case 'e':
exit(0);
}
}
20. P a g e | 16
Delete Student Detail
Before Delete
21. P a g e | 17
After Deleted
Coding:-
void del()
{
bor();
char id[5];
gotoxy(25,6);
cout<<"DELETE Student Detail";
gotoxy(25,8);
cout<<"Enter id::";
cin>>id;
f.open("std",ios::in);
u.open("temp",ios::out);
while(f.read((char *) &in,sizeof(in)))
{
if(strcmp(in.id,id)==0)
23. P a g e | 19
c=getch();
switch(c)
{
case 'c':
case 'C':
clrscr();
del();
case 'b':
case 'B':
clrscr();
main();
case 'E':
case 'e':
exit(0);
}
}
24. P a g e | 20
Search Student
View Search Record
25. P a g e | 21
Coding:-
void search()
{
bor();
gotoxy(25,6);
cout<<"SEARCH Student Details";
gotoxy(25,8);
cout<<"Enter id::";
cin>>w.id;
int c=0;
f.open("std",ios::in);
while(f.read((char *) &in,sizeof(in)))
{
if(strcmp(w.id,in.id)==0)
{
gotoxy(27,11);
cout<<"Name::"<<in.n;
gotoxy(27,13);
cout<<"Class::"<<in.l;
gotoxy(27,15);
cout<<"City::"<<in.c;
c=1;
}
}
if(c==0)
{
gotoxy(27,15);
cout<<"Data NOT found";
}
char c1;
gotoxy(20,20);
textcolor(4);
cprintf("C");
26. P a g e | 22
textcolor(7);
cout<<"ontinue";
gotoxy(39,20);
textcolor(4);
cprintf("B");
cout<<"ack";
gotoxy(55,20);
textcolor(4);
cprintf("E");
textcolor(7);
cout<<"xit";
c1=getch();
switch(c1)
{
case 'c':
case 'C':
clrscr();
search();
case 'b':
case 'B':
clrscr();
main();
case 'E':
case 'e':
exit(0);
}
}
};
clrscr();
file o;
o.op();
getch();
}