1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
#include "stdafx.h"
#include <iostream>
#include <sstream>
#include <fstream>
#include <string.h>
#include <cstdlib>
#include <string>
using namespace std;
int main()
{
string firstname; // need to make 2 variables for the first and last name, the code automatically looks for a space to separate the variables
string lastname;
cout << "Enter your first and last name:" << endl;
cin >> firstname >> lastname;
string phonenumber; // single variable for a single number, used string instead of int because int can only handle an 8 digit number
cout << "Enter your phone number with no spaces:" << endl;
cin >> phonenumber;
string address; // 7 part address, ie 123 South Shore Road, Miami, Florida 11111 - most common address type in existence.
cout << "Enter your full address with no punctuation:" << endl;
cin.ignore();
getline(cin, address);
string ccard; // string again, as it can handle multiple characters
cout << "Enter your credit card number:" << endl;
cin >> ccard;
string expdate; // string as it can handle characters and non-numerical characters
cout << "Enter your credit card expiration date in month/year format:" << endl;
cin >> expdate;
string cid; // could have used int but used string again just for homogeneity
cout << "Enter your CID:" << endl;
cin >> cid;
cout << "Thank you for visiting our website today, " << firstname << " " << lastname << ". Below you will find a list of products available for purchase at this time.";
cout << " Please enjoy your visit on our website." << endl; // welcome message as required
int search; // made search an int so that i can use it as an if else statement easily
int skechers; // make skechers and nike a variable
int nike;
int saucony;
int adidas;
int vans;
int converse;
int size;
int athoptions;
int quantity;
int total;
int final;
final = 0;
skechers = 55;
nike = 60;
saucony = 90;
adidas = 80;
vans = 100;
converse = 100; // set variables to their prices and create variables for the purchasing loop
char choice;
do {
cout << "Our categories are as follows: Athletic Shoes, Track Shoes, Casual Shoes. \n choose option 1, 2, or 3" << endl; // user chooses a number corresponding to category
cin >> search; // this wasn't required but I liked how it narrowed down options, I could/probably will populate these options further, and will possibly add in more categories
if (search == 1) {
cout << "Nike Running Shoes, sizes 8-13, blue/grey, $60" << endl;
cout << "Skechers Shape ups, Women's sizes 3-10, pink/green, $55" << endl; // two different athletic shoe options
cout << "Do you want Nike or Skechers? Choose option 1 or 2" << endl; // ask which shoes they want to buy
cin >> athoptions;
if (athoptions == 1) {
cout << "What size do you want? Sizes 8-13" << endl; // ask which size the user wants
cin >> size;
cout << "How many do you want?" << endl; // ask how many the user wants
cin >> quantity;
total = quantity * nike;
}
else if (athoptions == 2) {
cout << "What size do you want? Women's sizes 3-10" << endl; // ask which size user wants
cin >> size;
cout << "How many do you want?" << endl; // ask how many the user wants
cin >> quantity;
total = quantity * skechers;
}
}
else if (search == 2) {
cout << "Saucony Track shoes with .5 inch spikes, sizes 8-13, red/white/silver, $90" << endl;
cout << "Adidas Long Distance Track shoes with .25 inch spikes, sizes 8-13, green/gold, $80" << endl; // two different track shoe options
cout << "Do you want Saucony or Adidas? Choose option 1 or 2" << endl; // ask which shoes they want to buy
cin >> athoptions;
if (athoptions == 1) {
cout << "What size do you want? Sizes 8-13" << endl; // ask which size the user wants
cin >> size;
cout << "How many do you want?" << endl; // ask how many the user wants
cin >> quantity;
total = quantity * saucony;
}
else if (athoptions == 2) {
cout << "What size do you want? Sizes 8-13" << endl; // ask which size the user wants
cin >> size;
cout << "How many do you want?" << endl; // ask how many the user wants
cin >> quantity;
total = quantity * adidas;
}
}
else if (search == 3) {
cout << "Vans, sizes 8-13, white, $100" << endl;
cout << "Converse, sizes 8-13, black/white, $100" << endl; // two different casual shoe options
cout << "Do you want Vans or Converse? Choose option 1 or 2" << endl; // ask which shoes they want to buy
cin >> athoptions;
if (athoptions == 1) {
cout << "What size do you want? Sizes 8-13" << endl; // ask which size the user wants
cin >> size;
cout << "How many do you want?" << endl; // ask how many the user wants
cin >> quantity;
total = quantity * vans;
}
else if (athoptions == 2) {
cout << "What size do you want? Sizes 8-13" << endl; // ask which size the user wants
cin >> size;
cout << "How many do you want?" << endl; // ask how many the user wants
cin >> quantity;
total = quantity * converse;
}
}
else {
cout << "Invalid category number"; // what happens if 1, 2, or 3 are not selected
}
final = final + total;
cout << "Do you want to continue shopping? Y/N" << endl;
cin >> choice;
} while (choice == 'Y');
cout << "Your total purchase today is $" << final << ". Thank you for shopping with us. Your shoes will be shipped in 3-5 business days";
return 0;
}
|