Guru Harkrishan Public School: Computer Science Project ON "Credit Card Management System"
Guru Harkrishan Public School: Computer Science Project ON "Credit Card Management System"
PUBLIC SCHOOL
COMPUTER SCIENCE PROJECT
ON
“CREDIT CARD MANAGEMENT SYSTEM”
Class XII
Submitted to:
Department Of Computer Science
Submitted By:
SARTHAK SHARMA
XII-D
Roll No.---
I extend my hearty thanks to MR SHUKDEV NAYYAR, my computer
science teacher, who guided me to the successful completion of this
project. I take this opportunity to express my deep sense of gratitude
for his invaluable guidance, constant encouragement, constructive
comments, sympathetic attitude and immense motivation, which has
sustained my efforts at all stages of this project work.
Sarthak sharma
This is to certify that this project report “CREDIT CARD MANAGEMENT”
XII d for the year 2017 – 18 . He has carried out the project work under
my supervision.
MR SHUKDEV NAYYAR
INTRODUCTION
SOURCE CODE
OUTPUT
BIBLIOGRAPHY
Introduction
#include<fstream.h>
fstream ( classes used in data file handling )
ifstream
ofstream
#include<conio.h>
getch ()
gotoxy ()
clrscr ()
clreol ()
#include<stdio.h>
fflush ()
fscanf ()
gets ()
puts ()
getw ()
putw ()
printf ()
#include<stdlib.h>
time ()
abs ()
exit ()
random ()
#include<ctype.h>
isalpha ()
isdigit ()
islower ()
isupper ()
#include<process.h>
exit ()
system ()
getpid ()
#include<string.h>
strcmp ()
strcat ()
strlen ()
strcmpi ()
strcpy ()
#include<dos.h>
delay ()
enable ()
SOURCE CODE
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<process.h>
#include<string.h>
#include<dos.h>
void box()
char ch=219;
int i;
for(i=1;i<=78;i++)
gotoxy(i,1);
cout<<ch;
delay(10);
for(i=1;i<=25;i++)
{
gotoxy(78,i);
cout<<ch;
delay(10);
for(i=78;i>=1;i--)
gotoxy(i,25);
cout<<ch;
delay(10);
for(i=25;i>=1;i--)
gotoxy(1,i);
cout<<ch;
delay(10);
void box1()
char ch=219;
int i;
for(i=1;i<=78;i++)
{
gotoxy(i,1);
cout<<ch;
for(i=1;i<=25;i++)
gotoxy(78,i);
cout<<ch;
for(i=78;i>=1;i--)
gotoxy(i,25);
cout<<ch;
for(i=25;i>=1;i--)
gotoxy(1,i);
cout<<ch;
class menu_class
{
public:
void menu();
void report_menu();
void card_edit_menu();
void customer_edit_menu();
};
class card
private:
char cardname[15];
int cardcode;
int limit;
public:
cardcode=c;
strcpy(cardname,n);
limit=l;
void addcard();
void deletecard();
void display_cardrecord();
void display_cardlist();
int returncode();
int returncardcode()
return cardcode;
int returnlimit()
return limit;
char *returncardname()
return cardname;
};
class customer
public:
void addcust();
void deletecustomer();
void display_customerrecord();
void display_customerlist();
int returncardno();
private:
int cardno,t_cardcode,t_limit;
};
void menu_class::menu()
char ch;
clrscr();
box1();
gotoxy(30,2);
gotoxy(30,7);
cout<<"1.customer";
gotoxy(30,9);
gotoxy(30,11);
cout<<"3. Report";
gotoxy(30,13);
cin>>ch;
switch(ch)
case '1':
customer_edit_menu();
break;
case '2':
card_edit_menu();
break;
case '3':
report_menu();
break;
/////////////////////////////
void menu_class::card_edit_menu()
char ch;
card r;
do
clrscr();
box1();
gotoxy(30,8);
gotoxy(30,10);
gotoxy(30,12);
gotoxy(30,14);
cout<<"0. Exit";
gotoxy(30,16);
cin>>ch;
if (ch=='1')
r.addcard();
else if(ch=='2')
r.deletecard();
else if(ch=='3')
r.display_cardrecord();
else if (ch=='0')
menu();
else
gotoxy(30,20);
cout<<"wrong choice";
}while(ch!='0');
///////////////////////////////////////////////////////
void menu_class::customer_edit_menu()
char ch;
customer c;
do
clrscr();
box1();
gotoxy(30,8);
gotoxy(30,10);
gotoxy(30,14);
cout<<"0. EXIT";
gotoxy(30,17);
cin>>ch;
if(ch == '1')
c.addcust();
else if(ch=='2')
c.deletecustomer();
else if(ch=='3')
c.display_customerrecord();
else if (ch=='0')
menu();
else
gotoxy(30,20);
cout<<"wrong choice";
}while(ch!='0');
}
///////////////////////////////////////
void menu_class::report_menu()
char ch;
do
clrscr();
box1();
gotoxy(30,4);
gotoxy(30,6);
gotoxy(30,8);
cout<<"0. Exit";
gotoxy(30,10);
cin>>ch;
if(ch=='1')
card r;
r.display_cardlist();
}
else if(ch=='2')
customer c;
c.display_customerlist();
else if(ch=='0')
menu();
else
gotoxy(30,12);
cout<<"wrong choice";
}while(ch!='0');
////////////////////////
int card::returncode()
fstream file;
int code=0;
file.open("CARD.DAT",ios::in|ios::binary);
while(file.read((char *)this,sizeof(card)))
code++;
file.close();
return code;
///////////////////////////////////////////////////////////////////
int customer::returncardno()
fstream file;
int n=0;
file.open("CUST.DAT",ios::in|ios::binary);
while(file.read((char *)this,sizeof(customer)))
n++;
file.close();
return n;
//////////////////////////////
void card::addcard()
char ch;
clrscr();
box1();
gotoxy(25,2);
A:
gotoxy(10,4);
int code;
code=returncode();
gotoxy(35,4);
gets(cardname);
if (strlen(cardname)<=0 || strlen(cardname)>15)
gotoxy(25,6);
gotoxy(25,8);
getche();
gotoxy(25,6); clreol();
gotoxy(25,8); clreol();
gotoxy(25,4); clreol();
goto A;
B:
gotoxy(10,6);
gotoxy(35,6);
cin>>limit;
if(limit<=0)
gotoxy(10,8);
gotoxy(10,10);
gotoxy(10,8); clreol();
gotoxy(10,10); clreol();
gotoxy(25,6); clreol();
goto B;
cardcode=code+1;
fstream file;
file.open("CARD.DAT",ios::app|ios::binary);
file.write((char *)this,sizeof(card));
file.close();
///////////////////////////////////////////////////////////////////
void card::deletecard()
clrscr();
int flag=1;
char ch;
int n;
gotoxy(25,2);
gotoxy(10,4);
cin>>n;
gotoxy(1,10);
fstream file;
file.open("CARD.DAT",ios::in|ios::binary);
fstream tempfile;
tempfile.open("TCARD.DAT",ios::out|ios::binary);
while(file.read((char *)this,sizeof(card)))
if(cardcode!=n)
tempfile.write((char *)this,sizeof(card));
if(cardcode==n)
flag=0;
file.close();
tempfile.close();
if(flag==0)
fstream f1;
f1.open("TCARD.DAT",ios::in|ios::binary);
fstream t1;
t1.open("CARD.DAT",ios::out|ios::binary);
while(f1.read((char *)this,sizeof(card)))
t1.write((char *)this,sizeof(card));
gotoxy(10,6);
cout<<"RECORD DELETED...";
else
gotoxy(10,6);
gotoxy(40,18);
getch();
void card::display_cardrecord()
int n,flag=1;
clrscr();
box1();
gotoxy(25,2);
gotoxy(10,4);
cin>>n;
fstream file;
file.open("CARD.DAT",ios::in|ios::binary);
while(file.read((char *)this,sizeof(card)))
if(n==cardcode)
gotoxy(10,6);
gotoxy(10,8);
flag=0;
if(flag==1)
gotoxy(10,6);
gotoxy(40,18);
getch();
file.close();
}
////////////////////////
void card::display_cardlist(void)
fstream file;
file.open("card.dat",ios::in|ios::binary);
C:
clrscr();
box1();
gotoxy(18,2);
cout<<"LIST OF CARD";
gotoxy(8,5);
gotoxy(25,5);
gotoxy(40,5);
cout<<"Limit ";
row++;
gotoxy(8,row);
cout<<cardcode;
gotoxy(25,row);
cout<<cardname;
gotoxy(40,row);
cout<<limit;
if(row==22)
row=6;
gotoxy(53,23);
pageno++;
gotoxy(53,24);
getch();
goto C;
gotoxy(53,23);
gotoxy(53,24);
file.close();
///////////////////////////////////////////////////
void customer::addcust()
clrscr();
box1();
int n=returncardno();
gotoxy(25,2);
gotoxy(10,4);
gets(name);
gotoxy(10,5);
gets(address);
CC:
gotoxy(10,6);
gotoxy(30,6);
cin>>phone;
for(int i=0;i<strlen(phone);i++)
if(isalpha(phone[i]))
gotoxy(10,7);
getch();
gotoxy(10,7);
clreol();
gotoxy(30,6);
clreol();
goto CC;
D:
char str[10];
gotoxy(10,7);
gotoxy(30,7);
cin>>str;
for(i=0;i<strlen(str);i++)
{
if(isalpha(str[i]))
gotoxy(10,8);
getch();
gotoxy(10,8);
clreol();
gotoxy(30,7);
clreol();
goto D;
t_cardcode=atoi(str);
fstream file;
file.open("CARD.DAT",ios::in|ios::binary);
int found=0;
card r;
while(file.read((char *)&r,sizeof(card)))
if(t_cardcode==r.returncardcode())
{
found=1;
break;
if(found==0)
gotoxy(10,8);
gotoxy(10,9);
gotoxy(10,8);
getch();
clreol();
gotoxy(10,9);
clreol();
gotoxy(30,7);
clreol();
goto D;
cardno=n+1;
t_limit=r.returnlimit();
gotoxy(10,8);
cout<<"Your Card Number."<<cardno;
gotoxy(10,10);
fstream file1;
file1.open("CUST.DAT",ios::app|ios::binary);
file1.write((char *)this,sizeof(customer));
file1.close();
file.close();
gotoxy(40,18);
getch();
////////////////////////////////////
clrscr();
box1();
int n,flag=0;
char str[10];
gotoxy(25,2);
AA:
gotoxy(10,4);
gotoxy(30,4);
cin>>str;
for(int i=0;i<strlen(str);i++)
if(isalpha(str[i]))
gotoxy(10,5);
getch();
gotoxy(10,5);
clreol();
gotoxy(30,4);
clreol();
goto AA;
n=atoi(str);
fstream file;
file.open("CUST.DAT",ios::in|ios::binary);
fstream temp;
temp.open("TEMP.DAT",ios::out|ios::binary);
while(file.read((char *)this,sizeof(customer)))
if(n!=cardno)
temp.write((char *)this,sizeof(customer));
if(n==cardno)
flag=1;
file.close();
temp.close();
if(flag==1)
fstream f1;
f1.open("TEMP.DAT",ios::in|ios::binary);
fstream t1;
t1.open("CUST.DAT",ios::out|ios::binary);
while(f1.read((char *)this,sizeof(customer)))
t1.write((char *)this,sizeof(customer));
}
gotoxy(10,8);
cout<<"RECORD DELETED...";
f1.close();
t1.close();
else
gotoxy(10,8);
gotoxy(40,18);
getch();
file.close();
temp.close();
//////////////////////////////////////////////////////
clrscr();
int n,flag=0;
char str[10];
box1();
gotoxy(25,2);
BB:
gotoxy(10,4);
gotoxy(35,4);
cin>>str;
for(int i=0;i<strlen(str);i++)
if(isalpha(str[i]))
gotoxy(10,5);
getch();
gotoxy(10,5);
clreol();
gotoxy(35,4);
clreol();
goto BB;
}
n=atoi(str);
fstream file;
file.open("CUST.DAT",ios::in|ios::binary);
if(n==cardno)
gotoxy(10,6);
gotoxy(10,8);
gotoxy(10,10);
gotoxy(10,12);
card r;
fstream file1;
file1.open("CARD.DAT",ios::in|ios::binary);
while(file1.read((char *)&r,sizeof(card)))
if(t_cardcode==r.returncardcode())
{
gotoxy(10,14);
gotoxy(10,16);
flag=1;
if(flag==0)
gotoxy(10,6);
gotoxy(40,18);
getch();
file.close();
getch();
//////////////////////////////////////////
void customer :: display_customerlist()
clrscr();
fstream file;
box1();
file.open("CUST.DAT", ios::in|ios::binary);
card r;
int row=3,pageno=1;
gotoxy(25,2);
cout<<"LIST OF CUSTOMERS";
gotoxy(5,3);
cout<<"Card No.";
gotoxy(15,3);
cout<<"Name ";
gotoxy(25,3);
cout<<"Phone";
gotoxy(35,3);
cout<<"Card Code";
gotoxy(48,3);
cout<<"Card Name";
gotoxy(65,3);
cout<<"Card Limit";
while(file.read((char *)this,sizeof(customer)))
row++;
gotoxy(5,row);
cout<<cardno;
gotoxy(15,row);
cout<<name;
gotoxy(25,row);
cout<<phone;
gotoxy(35,row);
cout<<t_cardcode;
fstream file1;
file1.open("CARD.DAT",ios::in|ios::binary);
while(file1.read((char *)&r,sizeof(card)))
if(t_cardcode==r.returncardcode())
gotoxy(48,row);
cout<<r.returncardname();
gotoxy(65,row);
cout<<t_limit;
if(row==22)
row=5;
gotoxy(53,23);
cout<<"Page no.;"<<pageno;
pageno++;
gotoxy(53,24);
getch();
gotoxy(53,23);
gotoxy(53,24);
getch();
file.close();
void madeby()
{
textbackground(4);
clrscr();
box();
gotoxy(30,12);
gotoxy(30,13);
cprintf("SARTHAK SHARMA");
gotoxy(50,20);
getch();
void welcome()
textbackground(5);
clrscr();
box();
gotoxy(30,12);
gotoxy(50,20);
madeby();
void writecard()
fstream file;
card r[4];
r[0].input(1,"Diner card",8000);
r[1].input(2,"Classic card",9000);
r[2].input(3,"Gold card",10000);
r[3].input(4,"Executive card",12000);
file.open("CARD.DAT",ios::out|ios::binary);
for(int i=0;i<=3;i++)
file.write((char *)&r[i],sizeof(card));
file.close();
void main(void)
menu_class m;
welcome();
writecard();
m.menu();
}
OUTPUT
----1. Customer-------
-----2. Credit Card-------
------3. Report---------
-------0.Exit----------
BIBLIOGRAPHY