Professional Documents
Culture Documents
#include<string>
#include<fstream>
using namespace std;
struct guestcheckout1
{
string first_name, last_name, telephone, e_mail, country, region, continue1,
confirmation, continue2, continue3, comment, agree, address, city, post_code,
billlig_delivery_address_choice;
};
struct book
{
string book;
string author;
int views;
int price;
int ranking;
int stock;
string publisher;
string isbn;
string category;
};
MyFile.open("DETAILS.txt", ios::app);
if (!MyFile)
{
cout << "File creation failed";
}
else
{
cout << "New file created";
do
{
choice1();
getline(cin, choice);
if (choice == "1")
{
choicesearch();
getline(cin, choicesearch1);
cin.ignore(-1);
search(b);
cin.ignore();
addtocart();
copies();
cin >> ::count;
cin.ignore();
total();
checkout();
string d;
getline(cin, d);
cin.ignore(-1);
if (d == "Y")
{
checkout1();
choice2();
cin >> choice3;
if (choice3 == 1)
{
guestcheckout();
if (billlig_delivery_address_choice == "Y")
{
if (continue11 == "Y")
{
if (continue2 == "Y")
{
paymentmethod();
cin >> choicepaymemtmethod;
cin.ignore();
commentaboutyourorder();
getline(cin, comment);
cin.ignore(-1);
termsandconditions();
do {
cin >> agree;
cin.ignore(-1);
} while (agree != "Y");
if (choicepaymemtmethod == 3)
{
confirmation();
cin >> continue3;
cin.ignore(-1);
if (continue3 == "Y")
{
confirmorder();
cin >>
confirmation1;
if (confirmation1
== "Y")
{
finalconfirmation();
}
}
}
}
}
}
}
}
}
else if (add == "N")
{
notadded();
}
else
{
invalid();
}
copies();
cin >> ::count;
cin.ignore();
total();
checkout();
string d;
getline(cin, d);
cin.ignore(-1);
if (d == "Y")
{
checkout1();
choice2();
cin >> choice3;
if (choice3 == 1)
{
guestcheckout();
if (billlig_delivery_address_choice ==
"Y")
{
if (continue11 == "Y")
{
if (continue2 == "Y")
{
paymentmethod();
cin >>
choicepaymemtmethod;
cin.ignore();
commentaboutyourorder();
getline(cin, comment);
cin.ignore(-1);
termsandconditions();
do {
cin >> agree;
cin.ignore(-1);
} while (agree != "Y");
if (choicepaymemtmethod
== 3)
{
confirmation();
cin >> continue3;
cin.ignore(-1);
if (continue3 ==
"Y")
{
confirmorder();
cin >>
confirmation1;
if
(confirmation1 == "Y")
{
finalconfirmation();
}
}
}
}
}
}
}
}
}
else if (add == "N")
{
notadded();
}
else
{
invalid();
}
}
if (category == "children")
{
categorychildren(b);
booknumber();
cin >> booknumber1;
addtocart();
cin >> add;
cin.ignore(-1);
if (add == "Y")
{
copies();
cin >> ::count;
cin.ignore();
total();
checkout();
string d;
getline(cin, d);
cin.ignore(-1);
if (d == "Y")
{
checkout1();
choice2();
cin >> choice3;
if (choice3 == 1)
{
guestcheckout();
if (billlig_delivery_address_choice ==
"Y")
{
if (continue11 == "Y")
{
if (continue2 == "Y")
{
paymentmethod();
cin >>
choicepaymemtmethod;
cin.ignore();
commentaboutyourorder();
getline(cin, comment);
cin.ignore(-1);
termsandconditions();
do {
cin >> agree;
cin.ignore(-1);
} while (agree != "Y");
if (choicepaymemtmethod
== 3)
{
confirmation();
cin >> continue3;
cin.ignore(-1);
if (continue3 ==
"Y")
{
confirmorder();
cin >>
confirmation1;
if
(confirmation1 == "Y")
{
finalconfirmation();
}
}
}
}
}
}
}
}
}
else if (add == "N")
{
notadded();
}
else
{
invalid();
}
}
}
void addtocart(void)
{
cout << "Do you want to ADD TO CART?\n1.Enter Y for yes \n2.Enter N for no "
<< endl;
}
void copies(void)
{
}
void total(void)
{
}
void commentaboutyourorder(void)
{
cout << "Add comment about you order" << endl;
}
void termsandconditions(void)
{
cout << "I have read and agree to the Terms & Conditions " << endl;
cout << "Enter Y ofor yes and N for no" << endl;
}
void confirmation(void)
{
cout << "Do you want to continue.\nEnter Y for yes\nEnter anything for No."
<< endl;
}
void confirmorder(void)
{
guestcheckout1 g;
cout << "********Confirm Order*******" << endl;
cout << "****Shipping Details*****" << endl;
MyFile << "********Confirm details*******" << endl;
cout << "Name" << g.first_name + " " + g.last_name;
MyFile << "Name" << g.first_name + " " + g.last_name;
cout << "Country: " << g.country << endl;
MyFile << "Country: " << g.country << endl;
cout << "City: " << g.city << endl;
MyFile << "City: " << g.city << endl;
cout << "Reigion/State: " << g.region << endl;
MyFile << "Reigion/State: " << g.region << endl;
cout << "Address: " << g.address << endl;
MyFile << "Address: " << g.address << endl;
cout << "Phone: " << g.telephone << endl;
MyFile << "Phone: " << g.telephone << endl;
cout << "****Payment Detail****" << endl;
MyFile << "****Payment Detail****" << endl;
cout << "Payment Method: Cash On Delivery" << endl;
MyFile << "Payment Method: Cash On Delivery" << endl;
cout << "Name" << g.first_name + " " + g.last_name;
MyFile << "Name" << g.first_name + " " + g.last_name;
cout << "Country: " << g.country << endl;
MyFile << "Country: " << g.country << endl;
cout << "City: " << g.city << endl;
MyFile << "City: " << g.city << endl;
cout << "Reigion/State: " << g.region << endl;
MyFile << "Reigion/State: " << g.region << endl;
cout << "Address: " << g.address << endl;
MyFile << "Address: " << g.address << endl;
cout << "Phone: " << g.telephone << endl;
MyFile << "Phone: " << g.telephone << endl;
cout << "Confirmed Order\nEnter Y for yes and N for no" << endl;
}
void finalconfirmation(void)
{
cout << "Your Order Has Been Placed!" << endl;
cout << "Your order # GS9-IBD-NF21 has been successfully processed!\nPlease
direct any questions you have to the store owner.\nThanks werdftgasdfg for shopping
with us online!" << endl;
}
void notadded(void)
{
cout << "OK Selected book is not added to cart" << endl;
}
void invalid(void)
{
cout << "Kindly Enter the right value" << endl;
}
void selectcategory(void)
{
cout << "Select the category\nEnter urdu for urdu books \nEnter children
for children books" << endl;
}
void categoryurdu(book b[15])
{
for (int i = 0; i < 15; i++)
if (b[i].category == "urdu")
{
cout << "\n\nBook no " << i + 1 << endl;
count1 = b[i].views + 1;
cout << "****Book Information****** " << endl;
cout << "Name: " << b[i].book << endl;
cout << "Author: " << b[i].author << endl;
cout << "Views: " << count1 << endl;
cout << "Ratings: " << b[i].ranking << endl;
cout << "price: " << b[i].price << endl;
cout << "Stock available: " << b[i].stock << endl;
cout << "publisher: " << b[i].publisher << endl;
cout << "ISBN: " << b[i].isbn << endl;
cout << "Category: " << b[i].category << endl;
sum4 = b[i].price;
}
}
void categorychildren(book b[15])
{
}
void booknumber(void)
{
cout << "Enter book number" << endl;