#include <iostream>
#include <conio.h>
#include <string>
#include <string.h>
#include <fstream>
#include <stdlib.h>
#include <ctime>
/*
#include <iostream>
#include <ctime>
using namespace std;
int main() {
// current date/time based on current system
time_t now = time(0);
// convert now to string form
char* dt = ctime(&now);
cout << "The local date and time is: " << dt << endl;
The local date and time is: Sat Jan 8 20:07:41 2011
*/
using namespace std;
#define product_file "product.txt"
#define temp_file "temp.txt"
#define bill_file "bill.txt"
struct marketitem{
int num, quantity;
string name;
string manufacture_name;
float price, weight;
void add_item(){
cout << "Enter the item Number: ";
cin >> num;
cout << "Enter the item Name: ";
cin >> name;
cout << "Enter the item Manufacture Name: ";
cin >> manufacture_name;
cout << "Enter product Weight :";
cin >> weight;
cout << "Enter the item Price: ";
cin >> price;
cout << "Enter the item Quantity: ";
cin >> quantity;
}
void display_item(){
cout << "The item Number: " << num << "\n";
cout << "The item Name: " << name << "\t\t\t";
cout << "The item Manufacture Name: " << manufacture_name << "\n";
cout << "The item Price: " << price << "\t\t\t";
cout << "The item Quantity: " << quantity << "\n";
, cout << "The item Weight: " << weight<< "\n";
}
int item_num(){
return num;
}
string item_name(){
return name;
}
float item_price(){
return price;
}
int item_quantity(){
return quantity;
}
string item_manufacture_name(){
return manufacture_name;
}
};
marketitem item;
fstream pf;
fstream tf;
fstream bf;
void entry_hello()
{
cout << "Hi :)" << endl;
cout << "This is my super Market program"<<endl;
cout << "It is very easy to use" << endl;
cout << "1. Customer Panel: " << endl;
cout << "2. Admin Panel: " << endl<< endl;
cout << "------------------------"<<endl;
cout << "Enter your choice (1-2)" << endl;
}
void admin_hello(){
cout << "\n\nIt is very easy to use" << endl;
cout << "1. Create products: " << endl;
cout << "2. View products list: " << endl;
cout << "3. Search for product: " << endl ;
cout << "4. Delete item: " << endl << endl;
cout << "------------------------"<<endl;
cout << "Enter your choice (1-4)" << endl;
}
void create_item(){
pf.open(product_file, ios::out|ios::app);
if(pf.fail()){
cout << "Error opening the file...\n";
exit(1);
}
item.add_item();
pf.write((char*)&item, sizeof(marketitem));
pf.close();
cout << "Item Created successfully" << endl;
#include <conio.h>
#include <string>
#include <string.h>
#include <fstream>
#include <stdlib.h>
#include <ctime>
/*
#include <iostream>
#include <ctime>
using namespace std;
int main() {
// current date/time based on current system
time_t now = time(0);
// convert now to string form
char* dt = ctime(&now);
cout << "The local date and time is: " << dt << endl;
The local date and time is: Sat Jan 8 20:07:41 2011
*/
using namespace std;
#define product_file "product.txt"
#define temp_file "temp.txt"
#define bill_file "bill.txt"
struct marketitem{
int num, quantity;
string name;
string manufacture_name;
float price, weight;
void add_item(){
cout << "Enter the item Number: ";
cin >> num;
cout << "Enter the item Name: ";
cin >> name;
cout << "Enter the item Manufacture Name: ";
cin >> manufacture_name;
cout << "Enter product Weight :";
cin >> weight;
cout << "Enter the item Price: ";
cin >> price;
cout << "Enter the item Quantity: ";
cin >> quantity;
}
void display_item(){
cout << "The item Number: " << num << "\n";
cout << "The item Name: " << name << "\t\t\t";
cout << "The item Manufacture Name: " << manufacture_name << "\n";
cout << "The item Price: " << price << "\t\t\t";
cout << "The item Quantity: " << quantity << "\n";
, cout << "The item Weight: " << weight<< "\n";
}
int item_num(){
return num;
}
string item_name(){
return name;
}
float item_price(){
return price;
}
int item_quantity(){
return quantity;
}
string item_manufacture_name(){
return manufacture_name;
}
};
marketitem item;
fstream pf;
fstream tf;
fstream bf;
void entry_hello()
{
cout << "Hi :)" << endl;
cout << "This is my super Market program"<<endl;
cout << "It is very easy to use" << endl;
cout << "1. Customer Panel: " << endl;
cout << "2. Admin Panel: " << endl<< endl;
cout << "------------------------"<<endl;
cout << "Enter your choice (1-2)" << endl;
}
void admin_hello(){
cout << "\n\nIt is very easy to use" << endl;
cout << "1. Create products: " << endl;
cout << "2. View products list: " << endl;
cout << "3. Search for product: " << endl ;
cout << "4. Delete item: " << endl << endl;
cout << "------------------------"<<endl;
cout << "Enter your choice (1-4)" << endl;
}
void create_item(){
pf.open(product_file, ios::out|ios::app);
if(pf.fail()){
cout << "Error opening the file...\n";
exit(1);
}
item.add_item();
pf.write((char*)&item, sizeof(marketitem));
pf.close();
cout << "Item Created successfully" << endl;