When I try another flight number besides the first one it returns invalid and why arent my set(1) spacing out correctly #include#include#include#include#include#include using namespace std; int...

When I try another flight number besides the first one it returns invalid and why arent my set(1) spacing out correctly #include #include #include #include #include #include using namespace std; int main(){ string usern; //Declare string Usern string passwrd; //Declare string passwrd string _usern; //Declare string Usern string _passwrd; //Declare string passwrd string _fname; string _lname; string _time; string _destination; int ffn; //Declare ffn integer int seats; int flightno; //Declare flightno integer int _ffn; int _flightno; //Declare flightno integer int _total_seats; int _seats_available; double _price; double total; //Declare total variable int attemptCount = 0; string line = " "; bool match_found = 0 ; //variable which hold 1 if match found ifstream readFile1("accounts.dat"); ifstream readFile2("flights.dat"); bool match_found2 = 0;    while(getline(readFile2,line)) { //read file line by line till end of file stringstream iss(line); iss >> _flightno >> _destination >> _seats_available >> _time >> _price; cout < "please="" enter="" the="" flight="" no.="" of="" the="" flight="" you="" would="" like="" to="" book"="">< cin="">> flightno; if (flightno == _flightno){ match_found2 = 1;//update match_found } if (flightno != _flightno){ do { //System ask for a valid flight no. until one is given cout < "invalid="" flight="" no."="">< endl;="" cout="">< "please="" enter="" a="" valid="" flight="" no.="" of="" the="" flight="" you="" would="" like="" to="" book"="">< cin="">> flightno; if (flightno == _flightno) { match_found2 = 1;//update match_found break; } } while (match_found2 = 1); } }    cout < "there="" are=""><>< cout="">< "how="" many="" seats="" would="" you="" like="" to="" book?"="">< endl;="" cin="">> seats;    if (seats > _usern >> _passwrd >> _fname >> _lname >> _ffn; cout < endl="">< "congrats="">< _fname="">< setw(1)="">< _lname="">< setw(1)=""><> seats; if (seats > _usern >> _passwrd >> _fname >> _lname >> _ffn; cout < endl="">< "congrats="">< _fname="">< setw(1)="">< _lname="">< setw(1)="">< _seats_available);="" }="" if="" (flightno="" !="_flightno){" do="" {="" system="" ask="" for="" a="" valid="" flight="" no.="" until="" one="" is="" given="" cout="">< "invalid="" flight="" no."="">< endl;="" cout="">< "please="" enter="" a="" valid="" flight="" no.="" of="" the="" flight="" you="" would="" like="" to="" book"="">< cin="">> flightno; if (flightno == _flightno) { match_found2 = 1;//update match_found break; } } while (match_found2 = 1); } return 0; } FLIGHTS.DAT 236 BWI 195 6:15AM 208.44 336 MCO 175 9:50AM 272.98 955 ORD 100 1:35AM 98.89 353 JFK 50 10:00AM 179.55 112 PHX 10 1:41PM 507.10
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here