switch (classOfVehicle)
{
case 'E':
case 'e':
cout << "Economy vehicle cost: $" << eCost << endl;
selectedVehicleCost = eCost;
break;
case 'S':
case 's':
cout << "Sport vehicle cost: $" << sCost << endl;
selectedVehicleCost = sCost;
break;
case 'L':
case 'l':
cout << "Luxury vehicle cost: $" << lCost << endl;
selectedVehicleCost = lCost;
break;
case 'V':
case 'v':
cout << "Van vehicle cost: $" << vCost << endl;
selectedVehicleCost = vCost;
break;
case 'T':
case 't':
cout << "Truck vehicle cost: $" << tCost << endl;
selectedVehicleCost = tCost;
break;
}
if (eCost < selectedVehicleCost)
{
cout << "Economy is cheaper by: $" << selectedVehicleCost - eCost << endl;
}
if (sCost < selectedVehicleCost)
{
cout << "Sport is cheaper by: $" << selectedVehicleCost - sCost << endl;
}
if (lCost < selectedVehicleCost)
{
cout << "Luxury is cheaper by: $" << selectedVehicleCost - lCost << endl;
}
if (vCost < selectedVehicleCost)
{
cout << "Van is cheaper by: $" << selectedVehicleCost - vCost << endl;
}
if (tCost < selectedVehicleCost)
{
cout << "Truck is cheaper by: $" << selectedVehicleCost - tCost << endl;
}
cout << "Would you like another quote. Press Y for yes and N for no: ";
cin >> anotherQuote;
if(anotherQuote =='N'||anotherQuote =='n'){
run = false;}
else (anotherQuote == a,b,c,d,e,f,g,h,i,j,k,l,m,o,p,q,r,s,t,u,v,w,x,z || anotherQuote == A,B,C,D,E,F,G,H,I,J,K,L,M,O,P,Q,R,S,T,U,V,W,Z);
{
run = false;
cout << "Invalid input. Would you like another quote. Press Y for yes N for no: ";
cin >> anotherQuote;
}
if(anotherQuote =='N'||anotherQuote =='n'){
run = false;}
}
return 0;
}
double computeVehicleCost(double overageRate, int freeMiles, double dailyFee, int estimatedMiles)
help us help you.
explain exactly what you need.
use code tags.
you have a jillion integers with no initial value that you are making a mess with.
the letter a when typed by a user is 'a'.
int a; //a random value
if(x == a)//meaningless, a is random.
you want something like
if x is between a-z or A-Z which looks like this:
if( x >='a' && x <= 'z') || (x >='A' && x<='Z'))
I think. Its a bit hard to mind read what you want, but taking a guess.
there is a built in test if something is an ascii letter.
the above is the same as if(isalpha(x))
double quotes are strings, single quotes are letters, when coding literal values.