Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 16

qwertyuiopasdfghjklzxcvbnmqw

ertyuiopasdfghjklzxcvbnmqwert
yuiopasdfghjklzxcvbnmqwertyui
opasdfghjklzxcvbnmqwertyuiopa
Computer fundamental
sdfghjklzxcvbnmqwertyuiopasdf
Project of c++
ghjklzxcvbnmqwertyuiopasdfghj
Submitted to:-
Sir Talha Asghar
klzxcvbnmqwertyuiopasdfghjklz
xcvbnmqwertyuiopasdfghjklzxcv
bnmqwertyuiopasdfghjklzxcvbn
mqwertyuiopasdfghjklzxcvbnmq
wertyuiopasdfghjklzxcvbnmqwe
rtyuiopasdfghjklzxcvbnmqwerty
uiopasdfghjklzxcvbnmqwertyuio
pasdfghjklzxcvbnmqwertyuiopas
dfghjklzxcvbnmqwertyuiopasdfg
hjklzxcvbnmqwertyuiopasdfghjk
Submitted by:-

Muhammad Rizwan 15-EE-074

Aliya Bibi 15-EE-004

Hamza Nazar 15-EE-010

Umer khan 15-EE-014

Aown shah 15-EE-086


introduction
 The project is on Supermarket Billing
.
Supermarket is the place where customers come to purchase their daily
using products and pay for that. So there is a need to calculate how
many products are sold and to generate the bill for the customer .In our
project we have 2 users. First one is the administrator who will decide
the taxes and commissions on the products and can see the report of
any product. He is the one who will decide the products available for
customers. The second one is the customer or the billing manager who
can purchase the items available or can make the bill for the
customers. This project can also be used for online purchasing as the
customer can access it easily.

2
 
Work flow 
 
Work in the Supermarket will be done in thefollowing way:
1. The product will come in the store.
2. The Administrator will enter the information of the product in
database and price and discount available for each product.
3. The customer will come and take the basket withhim/her and choose
the product and take it to thecounter.
4. The bill calculating operator will enter the productnumber then it will
show its information and priceand the bill will be calculated and total
payment willshown.
5. Customer will pay for the products.
6. All the products will be packed and delivered tothe customer
Hadders files

#include<iostream>

#include<stdio.h>

#include<conio.h>

#include<stdlib.h>

#include<string>

#include<windows.h>
Functions
Void main()

Used for showing the loading and for welcome as output.

Void menu()

Used for showing menu which takes the customer name as input and
provides the login for admin and provides the exit.

Void customer()

For storing the customer information and the items bought by them.

Void admin()

For admin use for updating the product list.

Void showdata()

For showing the data entered.

Void enterdata()

For entering the data that Is the items, item code and item price.

Void password()

For entering the password and the login of the administration


#include<iostream>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string>
#include<windows.h>
using namespace std;

void menu(void);
void customer(void);
void enterdata(void);
void addmore(void);
void readdata(void);
void admin(void);
void showdata();
void password();
void place_order(void);

void exit(void);
struct
{
int item_no;
char name[50];
int price;

}data, update,check;
void main()
{
int i;
cout<<"\n\n\t ***** WELCOME TO SUPER MARKETING BILLING
SYSTEM *****\n";
cout<<"\n\n\n\t\t\t\tLoading";
for (i = 0; i <= 3; i++)
{
Sleep(500);
cout<<".";
}
system("cls");
menu();

_getch();
}
void menu()
{
int input;
cout << "\n\n\n\t\t\tSUPER MARKETING BILLING";
cout << "\n\t\t\t_______________________";
cout << "\n\n\n\t01.CUSTOMER";
cout << "\n\n\t02.ADMINISTRATION";
cout << "\n\n\t03.EXIT";
cout << "\n\n\tPlease Select Your Option(1-3)\t";
cin >> input;
system("cls");

switch (input)
{
case 1:
customer();
cout << "empty";

break;
case 2:
admin();
cout << "empty";
case 3:
exit();
default:
printf("Invalid");
Sleep(2000);
menu();
}
}

void customer()
{
int input2;
cout << "\n\n\n\t01.ADD ITEMS";
cout << "\n\n\t02.BILL DETAILS";
cout << "\n\n\t03.EXIT";
cout << "\n\n\tPlease Select Your Option(1-3)\t";
cin >> input2;
system("cls");
switch (input2)
{
case 1:
place_order();

case 2:
readdata();

case 3:
system("cls");
exit();
break;

break;
default:
cout << "invalid";
system("cls");
Sleep(2000);
menu();
}
}

void admin()
{
int a;
password();
cout << "\nenter 1 for enter data ";
cout << "\nenter 2 for add more data ";
cout << "\nenter 3 for read data ";
cout << "\nenter 4 for show data ";
cin >> a;
switch (a)
{
case 1:
enterdata();
break;

case 2:
addmore();
break;
case 3:
readdata();
break;
case 4:
showdata();
place_order();
default:

break;
}

}
void enterdata()
{

int choice,a;
FILE *fptr;

fptr = fopen("record.txt", "w");


cout<<"\nEnter Item Number:";
cin>>data.item_no;
cout<<"\nEnter the name:";
cin>>data.name;
cout << "\nEnter the Price:";
cin>>data.price;

fprintf(fptr, "%d %s %d \n", data.item_no, data.name, data.price);


fclose(fptr);
printf("\nDATA SAVED successfully!");
}
void readdata()
{
FILE *fptr;
fptr = fopen("record.txt", "r");
while (fscanf(fptr, "%d %s %d", &data.item_no, &data.name,
&data.price) != EOF)
{
cout<<"\t"<<data.item_no<<"\t"<<
data.name<<"\t"<<data.price;
cout << "\n";
//cout << "want to add items in your Cart";
/*printf("Item_No:%d \tItem_Name:%s \tPrice:%d\n",
data.item_no, data.name, data.price);*/
//
}
Sleep(5000);
fclose(fptr);
}
void addmore()
{
int choice;
FILE *fptr;
fptr = fopen("record.txt", "a+");
product_no:
system("cls");
printf("\n\n\t\t\t***New ITEM***");
printf("\n\nEnter the New Code of Product:");
cin>>check.item_no;
while (fscanf(fptr, "%d %s %d", &data.item_no, &data.name,
&data.price) != EOF)
{
if (check.item_no == data.item_no)
{
printf("Product already exist!");
Sleep(2000);
goto product_no;
}
}
data.item_no = check.item_no;
cout << "\nEnter the name of Product:";
cin >> data.name;
cout << "\nEnter the Price of Product:";
cin >> data.price;

fprintf(fptr, "%d %s %d \n", data.item_no, data.name, data.price);


fclose(fptr);
printf("\nDATA SAVED successfully!");

}
void showdata()
{
FILE *fptr;
fptr = fopen("record.txt", "r");
while (fscanf(fptr, "%d %s %d", &data.item_no, &data.name,
&data.price) != EOF)
{
cout << "\t\t" << data.item_no << "\t\t" << data.name <<
"\t\t" << data.price;
cout << "\n";

}
fclose(fptr);
}

void place_order()
{
FILE *fptr,*fqtr;
int order_arr[50], quan[50], c = 0;
char ch;
float amt, total = 0;
cout << "\n\t\t===================================";
cout << "\n\t\t PLACE YOUR ORDER";
cout << "\n\t\t===================================";
cout << "\n\n\n";
cout << "\t\tPr.No\t\tPr.Code\t\tPrice\n";
showdata();
cout << "\n\n\n";

fptr = fopen("record.txt", "r");


fqtr = fopen("bill.txt","w");

do{
cout << "\n\nEnter Product Number";
cin >> order_arr[c];
cout << "enter quantity";
cin >> quan[c];
//c++;
cout << "Do you want to order any other Product ?(y/n)";
cin >> ch;
} while (ch == 'y' || ch == 'Y');
cout << "thank u for placing order";
system("cls");
cout << "\n\nINVOICE\n";
cout << "Pr.NO\tPr.Name\tPr.Price\tAmount";
fprintf(fqtr,"**********INVOICE**********");
fprintf(fqtr,"\nPr.NO\tPr.Name\tPr.Qty\tPr.Price\tAmount");
//Sleep(5000);
for (int x = 0; x <= c; x++)
{
while (fscanf(fptr, "%d %s %d", &data.item_no,
&data.name, &data.price) != EOF)
{
if (order_arr[c] == data.item_no)
{

amt = data.price*quan[x];
cout << "\n" << order_arr[x] << "\t" <<
data.name << "\t" << quan[x] << "\t\t" << data.price << "\t" << amt;
fprintf(fqtr, "%d\t%s\t%d\t%d\t%d\n",
order_arr[x], data.name, quan[x], data.price,amt);
total += amt;

}
cout << "\n\n\n\n\nTOTAL=" << total;
_getch();
fclose(fptr);
fclose(fqtr);
}
void password()
{
string arr[3][3] = { "sonu", "1234", "Welcom Shahzaib", "rizwan",
"3456", "Welcom Rizwan" };
string user_name;
string password;
char pas[10];

cout << "Enter user name :";


cin >> user_name;
cout << "Enter Password :";
cin >> password;
system("cls");
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
if (user_name == arr[i][j])
{
if (password == arr[i][j + 1])
{

cout << arr[i][j + 2];

}
void exit()
{
exit(0);

You might also like