I need to make a program that takes user input and check for errors after all the data has been entered, I keep getting an error on line 37 : error: no match for 'operator>=' in 'airline >=3'
for 'operator>=' in 'destination >=5'
for 'operator>=' in 'airISO >=5'
if someone could help me fix this problem or just point in the correct direction I would it.
string airLine; //will be used to store complete airline name not ISO code
string destination; // Starting point to final destination
string airIso; // holds ISO code for airline as well as flight #
double tripMiles = 0.0; //will hold miles for individual trips
double tripCost = 0; //will hold cost for individual trips
double totalCost = 0; //will add prices from trips
double totalMiles = 0; //will add all miles from trips
cout <<"What airline will you be using?\n";
//asking for origin and detination
cout <<"Enter point of origin and destination\n";
//ask for airline ISO code and flight #
cout <<"Enter airlines ISO code and flight number\n";
//ask for miles traveled
cout <<"Enter miles traveled\n";
cin >> tripMiles;
//ask for price of ticket
cout <<"Enter cost of ticket\n";
cin >> tripCost;
Thank you for your reply! So, basically what this program needs to do, on 3 separate occasions, is to ask the user for information, once the user submits all the data, the program will then do a simple check of this data. For example- the user should input a complete name of an airline, this could be a fictional or a real Airline, but the name has to have more than 3 characters
: cout <<"What airline will you be using?\n";
If the data is "correct" according to our parameters, the program should then save tripMiles; as well as tripCost to totalCost and totalMiles.
Once that is completed, the user will have to answer the questions again, they can use the same or information. the prgram will check again for errors, if none are found we need to add the new values from tripMiles; and tripCost to totalCost and totalMiles.
This process will be repeated once more (users data/ checking for errors). Again taking the new values from tripMiles; and tripCost to totalCost and totalMiles.
the final step will be to average the cost per mile using data from the previous steps.
Thanks for the clarification.
The length, which is what you need, to see whether there are at least three characters, can be found using either .size() or .length() if (airLine.size() >= 3)
or if (airIso.length() >= 5)
and so on.
Hope this helps you to get a bit further with this now.