Displaying Source Code(s)
|
|
A Departmental Store Program.
--------------------------------------------------------------------------------
Description : A perfect program designed for a Departmental
Store.
#include<iostream.h>
#include<graphics.h>
#include<dos.h>
#include<ctype.h>
#include<string.h>
#include<fstream.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<iomanip.h>
#define BACK 8
#define ENTER 13
char pass[10]="pawan";
class market
{
private:
int ss;
char checkername[30];
struct goods
{
int no;
char name[30];
float quantity;
float cost_per_unit;
}good,temp;
struct customer
{
char name[30];
char add[30];
char telno[30];
char purchase[30];
int day;
int mont;
int saal;
float quan;
float rate;
float pay;
float exp;
float profit;
}cus;
public:
int today;
int month;
int year;
int counter();
void ent_good();
void sell();
void update_inventory();
void see_inventory();
void see_product();
void see_customer();
void update();
void bill(customer s);
void graph();
int checker();
void expenditure();
void password();
void date();
void time();
void frontpage();
//void cat();
};
void market::date()
{
struct date d;
getdate(&d);
gotoxy(58,7);
printf("DATE: %d/%d/%d",d.da_mon,d.da_day,d.da_year);
today=d.da_day;
month=d.da_mon;
year=d.da_year;
}
void market::frontpage()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"D:\backups\borlandc\bgi");
clrscr();
clearviewport();
setbkcolor(BLACK);
setcolor(9);
setfillstyle(SOLID_FILL,1);
floodfill(486,71,6);
rectangle(470,259,630,400);
settextstyle(2,HORIZ_DIR,5);
setcolor(11);
outtextxy(503,270,"A PROJECT ON ");
outtextxy(489,280,"DEPARTMENTAL STORE");
outtextxy(505,360+8,". PAWAN REGMI");
setcolor(9);
line(470,293,630,293);
line(10,400,10,150);
line(10,400,140,450);
line(10,150,140,108);
line(489,293,489,400);
setfillstyle(HATCH_FILL,9);
fillellipse(320,30,320,30);
setfillstyle(CLOSE_DOT_FILL,BLUE);
fillellipse(190,280,140,183);
settextstyle(3,HORIZ_DIR,4);
setcolor(YELLOW);
outtextxy(180,12,"THE MAIN MENU");
settextstyle(7,VERT_DIR,3);
outtextxy(20,180,"YOUR OPTIONS");
settextstyle(2,VERT_DIR,4);
outtextxy(475,301,"Created By:");
settextstyle(7,HORIZ_DIR,2);
setcolor(WHITE);
outtextxy(90,155+15," NTRY OF GOODS");
outtextxy(90,185+15," ELL GOODS");
outtextxy(90,215+15," IEW INVENTORY");
outtextxy(90,245+15," IND GOOD");
outtextxy(90,275+15," USTOMER DETAIL");
outtextxy(90,305+15," PDATE PRODUCT");
outtextxy(157,335+35,"E IT");
setcolor(YELLOW);
outtextxy(87,170,"E");
outtextxy(87,200,"S");
outtextxy(87,230,"V");
outtextxy(87,260,"F");
outtextxy(87,290,"C");
outtextxy(87,320,"U");
outtextxy(168,370,"X");
}
void market::time()
{
struct dostime_t t;
_dos_gettime(&t);
printf(" TIME: %2d:%02d:%02d.<BR>, t.hour,
t.minute,t.second);
}
int market::counter()
{
int count=0;
ifstream file;
file.open("pasal.txt",ios::app|ios::in||ios::binary);
file.seekg(0,ios::beg);
while(file.read((char*)&good,sizeof(goods)))
count++;
file.close();
return count+1;
}
int market::checker()
{
ifstream fil;
int st=0;
fil.open("pasal.txt",ios::app|ios::in|ios::binary);
fil.seekg(0,ios::beg);
while(fil.read((char*)&good,sizeof(goods)))
{
if(stricmp(checkername,good.name)==0)
{
st=1;
ss=good.no;
break;
}
}
fil.close();
return st;
}
void market::ent_good()
{
ofstream file;
int t_no;
char reply;
file.open("pasal.txt",ios::app|ios::out);
t_no=counter();
cout<<endl<<endl<<endl<<endl<<endl;//gotoxy(1,10);
closegraph();
//cin=getch();
cout<<"
WE-4 DEPARTMENTAL STORE";
cout<<"
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ";
cout<<"
ITEM NAME : ";
gets(checkername);
int tk=checker();
if(tk==0)
{
strcpy(good.name,checkername);
good.no=t_no;
cout<<"
QUANTITY : ";
cin>>good.quantity;
cout<<"
COST PER UNIT : ";
cin>>good.cost_per_unit;
cout<<"
GOOD SUCCESSFULLY ENTERED";
delay(1500);
file.write((char*)&good,sizeof(goods));
file.close();
}
else
{
cout<<"
The good "<<good.name<<" already exists in store
You can update it ";
cout<<"
Do you want to update it (y/n): ";
cin>>reply;
cout<<endl<<endl<<" Its product number is: "<<ss<<" ";
reply=toupper(reply);
if(reply=='Y')
{
cout<<"
UPDATING";
cout<<"
ÄÄÄÄÄÄÄÄ";
update();
}
}
}
void market::password()
{
char pp[20];
int i=0,tt=0;
//char as='Y';
for(int ppp=0;ppp<3;ppp++)
{
clrscr();
gotoxy(12,3);
cout<<"ENTER CURRENT PASSWORD: ";
while((pp[i]=getch())!=ENTER)
{
if(pp[i]==BACK)
{
--i;
gotoxy(40+i,3);
cout<<" ";
}
else
{
gotoxy(40+i,3);
cout<<"*";
i++;
}
}
pp[i]=' |
|
|