Beruflich Dokumente
Kultur Dokumente
Timothy Hinh
PIC 10A Intro. to Progra
mming
ID: 604-456-658
Fall 2015
Email: timothyhinh79@gmail.com
Assignment #3
Section: sec# 4B
Honesty Pledge:
I, Timothy Hinh, pledge that this is my own independent
work, which conforms to the guidelines of academic honesty as
described in the course syllabus.
List of known bugs:
*/
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
using namespace std;
int main()
{
stringstream output; // needed to store values from input and prices in
table format to be displayed at the end of program
string input; // this will be used repeatedly for every string input
string initials;
string costContinue;
bool properInput; // needed to set loops for when the user puts in bad i
nput for the transport/hotel or yes/no questions
int numTripsOrNights;
int initial = 0;
double prices; // this will be used repeatedly for every number input
double euroUSDConversion;
double total = 0; // initialization necessary for use in loops, stores t
otal value after every number input (prices) from user
output << fixed << setprecision(2);
output << "Summary of your trip\n"
<< "--------------------\n\n";
cout << "Name of the traveler: ";
getline(cin, input);
output << "Name: " << input << endl;
do {
initials += input.substr(initial, 1);
initial = input.find(" ", initial) + 1;
}
while (initial - 1 != string::npos); // This do-while loop takes
the initials of the user.
output << "Initials: " << initials << endl;
cout << "Date of departure: ";
getline(cin, input);
output << "Departure: " << input << endl;
cout << "Arrival: ";
getline(cin, input);
output << "Arriving: " << input << "\n\n";
cout << "Cost of the Euro / USD conversion: ";
cin >> euroUSDConversion;
cin.ignore();
output << "----------------------------\n\n";
output << left << setw(40) << "Object" << right << setw(20) << "Total EU