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 130 131 132 133 134 135 136
|
#include <iostream>
#include <array>
#include <time.h>
#include <string>
#include <iomanip>
using namespace std;
struct PersonalInfo
{
string Name;
int Age;
string locationName;
int Budget_Amount;
};
const int personalCount = 4;
const int locationCount = 5;
const int ageCount = 4;
void getName(PersonalInfo &);
string myLocation(PersonalInfo &);
void getAge(PersonalInfo &);
//double myBudget(PersonalInfo &Budget, float car, float plane, float hotel);
double getBudget(float car, float plane, float hotel);
int main()
{
array <PersonalInfo, personalCount> Traveler;
array <PersonalInfo, locationCount> Location;
array <PersonalInfo, ageCount> Age;
int adult_1_age, adult_2_age;
int child_1_age, child_2_age;
double budget = 0.0f;
double car, plane, hotel;
cout << "\n\t\t\t\t\t\t\t\t\t\t\t\t\t===============================\n";
cout << "\n\t\t\t\t\t\t\t\t\t\t\t\t\t Trip Planner \n";
cout << "\n\t\t\t\t\t\t\t\t\t\t\t\t\t===============================\n";
/*
for (PersonalInfo &N : Traveler)
{
getName(N.Name);
}
for (PersonalInfo &A : Age)
{
getAge(A.Age);
}
for(PersonalInfo &L : Location)
{
myLocation(L.locationName);
}
*/
cout << "Would you need a rental car at your destination? \n[1] for yes or [2] for no: ";
int answer;
cin >> answer;
if (answer == 1)
{
cout << "How much do you want to spend on your rental car?: ";
cin >> car;
if (answer == 2)
cout << "A very heahlty choice!";
}
cout << "Are you going to fly? \n[1] for yes or [2] for no: ";
int answer2;
cin >> answer2;
if (answer2 == 1)
{
cout << "How much do you want to spend on your rental car?: ";
cin >> plane;
if (answer == 2)
cout << "Staying close to home are we?";
}
cout << "Are you going to need a hotel? \n[1] for yes or [2] for no: ";
int answer3;
cin >> answer3;
if (answer3 == 1)
{
cout << "How much do you want to spend on your Hotel?: \n";
cin >> hotel;
if (answer3 == 2)
cout << "I LOVE CAMPING CAN I COME TOO?\n";
}
cin.get();
cout << "Your budget looks like this $" << getBudget(car, plane, hotel) << endl;
//getBudget(car, plane, hotel);
cin.get();
return 0;
}
//Begin Functions
void getName(PersonalInfo &Explorer)
{
cout << "What are your Names?: " << Explorer.Name;
getline(cin, Explorer.Name);
}
void getAge(PersonalInfo &Age)
{
cout << "What are the age of the travelers?: ";
cin >> Age.Age;
}
string myLocation(PersonalInfo &Location)
{
cout << "What are your location interest?: " << Location.locationName;
getline(cin, Location.locationName);
}
double getBudget(float car, float plane, float hotel)
{
float budget = car + plane + hotel;
return budget;
}
/*
double myBudget(PersonalInfo &Budget)
{
float getBudget = car + plane + hotel;
return myBudget;
}*/
|