Program in c++ for Shopping Mall Management System...
C++ FEATURES
USED IN THIS
PROJECT:
1.CLASSES
2.OBJECT
3.ARRAY
4.FUNCTIONS
5.SYSTEM CALLS
6.MESSAGE BOX
7.FILE HANDLING
8.LOOPING
9.STRINGS
SOURCE CODE
#include<conio.h>
#include<stdio.h>
#include<windows.h>
#include<iostream.h>
#include<fstream.h>
#include<string.h>
using
namespace std;
class pr
{
public:
char a[50][30];
int n,i;
int b[50];
int n3[50];
int n1;
int t;
float sum;
float ds;
string filen;
public:
int box()
{
MessageBox(NULL,
"\n WELCOME TO MY PROGRAM \n"
" ****************THIS PROGRAM IS MADE
BY PIYUSH********\n"
"\n"
" TOPIC = SHOPPING MALL\n"
"\n"
" LANGUAGE USED = C++"
,"CODED BY
SHAHID",MB_OK);
return 0;
}
int title()
{
system("cls");
cout<<"************************************************************************\n";
cout<<" SHOPPING MALL MADE
BY PIYUSH
\n";
cout<<"*************************************************************************\n";
return 0;
}
int
part1()
{
system("color
a");
system("cls");
cout<<"\n\n Enter no. of items
\n";
cin>>n;
for(i=0;i<=n-1;i++)
{
system("color a");
cout<<"****************
"<<i+1 <<"th
ITEM******************************** \n";
cout<<"\n Enter the name of item
::";
cin>>a[i];
cout<<"Enter price for
"<<i+1 <<"th item::";
cin>>b[i];
cout<<"*************** "<<i+1 <<"th ITEM DETAIL ENTERD******************\n";
cout<<"\n
\n\n";
}
ofstream myfile ("d:\\23.txt");
if (myfile.is_open())
{
system("color a");
myfile<<" SR "<<"
"<<"ITEM"<<"
"<<"PRICE"<<"\n";
myfile<<"-----"<<"
"<<"----"<<" "<<"-----"<<"\n";
myfile<<"
\n";
for(i=0;i<=n-1;i++)
{
myfile<<" "<<i+1 <<" "<<a[i]<<" "<<b[i]<<"\n"
;
}
myfile.close();
}
else
{
system("color a");
cout << "Unable to open
file";
system("pause");
}
return 0;
}
int num()
{
cout<<"******************ITEM
TO BUY ************************\n\n";
cout<<"Enter number of
ITEMS TO SELECT ::";
cin>>n1;
for(i=0;i<=n1-1;i++)
{
system("color a");
cout<<"***********"<<i+1 <<"th ITEM FOR
BUY **********************\n\n";
cout<<"Enter "
<<i+1 <<"th ITEM
::";
cin>>n3[i];
if(n3[i]>n)
{
cout<<"WRONG VALUE \n";
cout<<"PROGRAM WILL EXIT\n";
return 1;
}
}
for(i=0;i<=n1-1;i++)
{
n3[i]=n3[i]-1;
}
return 0;
}
int detail()
{
ofstream myf("d:\\25.txt");
for(i=0;i<=n1-1;i++)
{
n3[i];
system("color a");
if
(myf.is_open())
{
myf<<"ITEM DETAILS
\n";
myf<<"ITEM
="<<a[n3[i]]<<"\n";
myf<<"PRICE="<<b[n3[i]]<<"\n";
myf<<"------------------\n";
}
}
return 0;
}
int sum2()
{
sum=0;
for(i=0;i<=n1-1;i++)
{
sum=sum+ b[n3[i]];
}
system("color
a");
// cout<<"SUM IS
="<<sum<<"\n";
if(sum>=1000)
{
system("color a");
//
cout<<"20% DISCOUNT FOR U\n";
ds=sum*0.2;
sum=sum-ds;
//cout<<"AFTER DISCOUNT
"<<sum<<"\n";
system("pause");
}
else
{
system("color
a");
//cout<<"10%
Discount for U\n";
ds=sum*0.1;
sum=sum-ds;
//cout<<"AFTER DISCOUNT
"<<sum<<"\n";
system("pause");
}
ofstream mys("d:\\24.txt");
if (mys.is_open())
{
mys<<"********BILL*************\n" ;
mys<<"BILL CALCULATIONS\n";
mys<<"TOTAL MRP
="<<sum+ds<<"\n";
mys<<"DISCOUNT
="<<ds<<"\n";
mys<<"NET BILL="<<sum<<"\n";
mys<<"********END***********\n";
}
return 0;
}
int red()
{
ifstream ar("D:\\23.txt");
if(ar.is_open())
{
while(!ar.eof())
{
getline(ar,filen);
//
cout<<filen<<endl;
}
system("pause");
}
else
{
system("color
a");
cout<<"ERROR HERE ";
system("pause");
}
getch();
return 0;
}
int
redz()
{
ifstream
ar("D:\\23.txt");
if(ar.is_open())
{
while(!ar.eof())
{
getline(ar,filen);
cout<<filen<<endl;
}
system("pause");
}
else
{
system("color a");
cout<<"ERROR HERE
";
system("pause");
}
getch();
return
0;
}
int
red1()
{
ifstream
ar1("D:\\24.txt");
if(ar1.is_open())
{
while(!ar1.eof())
{
getline(ar1,filen);
cout<<filen<<endl;
}
system("pause");
}
else
{
system("color a");
cout<<"ERROR HERE ";
system("pause");
}
getch();
return
0;
}
int red2()
{
ifstream
ar2("D:\\25.txt");
if(ar2.is_open())
{
while(!ar2.eof())
{
getline(ar2,filen);
cout<<filen<<endl;
}
system("pause");
}
else
{
system("color a");
cout<<"ERROR HERE ";
system("pause");
}
getch();
return
0;
}
int prc()
{
int c;
title();
system("color a");
cout<<"UR OPTIONS ARE \n";
cout<<" \n";
cout<<" \n";
cout<<"1.ENTRY & BUY \n";
cout<<" \n";
cout<<"2.LIST \n";
cout<<" \n";
cout<<"3.DETAIL \n";
cout<<" \n";
cout<<"4.BILL \n";
cout<<" \n";
cout<<"5.EXIT \n";
cout<<" \n";
cout<<"ENTER UR CHOICE \n";
cin>>c;
switch(c)
{
case 1:
{
part1();
red();
num();
detail();
sum2();
// ob.sum1();
break;
}
case 2:
{
system("cls");
redz();
break;
}
case 3:
{
red2();
system("pause");
break;
}
case 4:
{
red1();
system("pause");
break;
}
case 5:
{
cout<<"THXX FOR USING
MY PROGRAM \n";
return 1;
break;
}
default:
{
cout<<"WRONG
CHOICE \n";
system("pause");
}
}
int ck;
cout<<"\n\n\n 1.RESTRAT
2.EXIT\n";
cout<<"Enter
choice \n";
cin>>ck;
switch(ck)
{
case 1:
{
return prc();
break;
}
case 2:
{
return 1;
break;
}
default:
{
cout<<"WRONG
CHOICE \n";
system("pause");
}
}
return 0;
}
};
int main()
{
pr ob;
ob.box();
char
pass[40];
system("color a");
cout<<"\n\nENTER
PASSWORD\n";
cin>>pass;
if((strcmp(pass,"CPP")==0))
{
MessageBox(NULL,
"\n *********ACESS
GRANTED*****************\n"
,"CODED BY PIYUSH",MB_OK);
ob.prc();
}
else
{
MessageBox(NULL,
"\n *********WRONG
PASSWORD*****************\n"
,"CODED BY PIYUSH",MB_OK);
return 1;
}
getch();
return 0;
}
/* IF U FOUND ANY PROBLEM IN THIS PROGRAM OR IF YOU HAVE ANY QUERY RELATED THIS PROGRAM THEN PLEASE COMMENT IN THIS POST OR YOU CAN DIRECTLY MAIL ME ON piyushkhandelwal029@gmail.com . */
THANKU.
0 comments:
Post a Comment