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
|
#include <iostream>
#include <string>
using namespace std;
double GoldAtStart;
string NameItem[20];
double BuyPrice[20] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
double QuantityItem[20] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
double TotalAfterFee[20] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
double SellPrice[20] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int UserInput;
int x = 0;
double FeeDeductor(double SellPrice, double Quantity);
void UponOpening();
int main(){
cout << "Enter the amount of gold in your inventory" << endl;
cin >> GoldAtStart;
UponOpening();
}
double FeeDeductor(double FSellPrice, double FQuantity){
TotalAfterFee[x] = (FSellPrice * FQuantity) - .15*(FSellPrice * FQuantity);
return TotalAfterFee[x];
}
void UponOpening(){
cout << "What would you like to do?" << endl << endl;
cout << "1. Add an item to the database" << endl;
cout << "2. Option 2" << endl;
cout << "3. Option 3" << endl;
cout << "4. Option 4" << endl;
cin >> UserInput;
if(UserInput ==1){
cout << "Enter the name of the item you are buying" << endl;
cin.ignore();
getline(cin, NameItem[x]);
cin.clear();
cout << "Price purchased for?" << endl;
cin >> BuyPrice[x];
cout << "Quantity purchased?" << endl;
cin >> QuantityItem[x];
cout << "What do you intend to sell it for?" << endl;
cin >> SellPrice[x];
cout << "Item successfully entered into the database" << endl << endl;
x++;
UponOpening();
}
}
|