error: no match for operator ==

Hey. This is a program that is suppose to get user input for either 3-day or express shipping, then calculate cost. yet the program cant get past the user input 3-day. this is the only error in the program (according to xcode) any help is much appreciated

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

int main()
{

string shipping;
cout << "Would you like 3-Day shipping or Express shipping(3-Day/Express)?";
getline (cin, shipping);

if ( shipping == '3-Day')
{
cout << "Please select one of the following sizes by choosing the corresponding letter " << endl;
cout << " Size Letter" << endl;
cout << " 2 X 6 X 4 A " << endl;
cout << " 2 X 10 X 4 B " << endl;
cout << " 6 X 8 X 8 C " << endl;
cout << " 10 X 12 X 4 D " << endl;
cout << " 14 X 16 X 2 E " << endl;
cout << " 18 X 20 X 6 F " << endl;

double a = 4.45, b = 4.95, c = 6.35;
double d = 7.15, e = 8.05, f = 9.65;
char letter;
int number;


cout << "Please enter your choice ";
cin >> letter;

if (letter == 'A')
{
cout << "How many 2 X 6 X 4 boxes would you like to purchase with 3-day shipping? ";
cin >> number;
double atotal = number * a;
cout << "Your total is $" << fixed << setprecision(2) << atotal << endl;
}

if (letter == 'B')
{
cout << "How many 2 X 10 X 4 boxes would you like to purchase with 3-day shipping? ";
cin >> number;
double btotal = number * b;
cout << "Your total is $" << fixed << setprecision(2) << btotal << endl;
}

if (letter == 'C')
{
cout << "How many 6 X 8 X 8 boxes would you like to purchase with 3-day shipping? ";
cin >> number;
double ctotal = number * c;
cout << "Your total is $" << fixed << setprecision(2) << ctotal << endl;
}

if (letter == 'D')
{
cout << "How many 10 X 12 X 4 boxes would you like to purchase with 3-day shipping? ";
cin >> number;
double dtotal = number * d;
cout << "Your total is $" << fixed << setprecision(2) << dtotal << endl;
}

if (letter == 'E')
{
cout << "How many 14 X 16 X 2 boxes would you like to purchase with 3-day shipping? ";
cin >> number;
double etotal = number * e;
cout << "Your total is $" << fixed << setprecision(2) << etotal << endl;
}

if (letter == 'F')
{
cout << "How many 18 X 20 X 6 boxes would you like to purchase with 3-day shipping? ";
cin >> number;
double ftotal = number * f;
cout << "Your total is $" << fixed << setprecision(2) << ftotal << endl;
}
}
else
{
cout << "Please select one of the following sizes by choosing the corresponding letter " << endl;
cout << " Size Letter" << endl;
cout << " 2 X 6 X 4 A " << endl;
cout << " 2 X 10 X 4 B " << endl;
cout << " 6 X 8 X 8 C " << endl;
cout << " 10 X 12 X 4 D " << endl;
cout << " 14 X 16 X 2 E " << endl;
cout << " 18 X 20 X 6 F " << endl;

double a = 6.05, b = 7.65, c = 9.05;
double d = 10.25, e = 13.10, f = 15.55;
char letter;
int number;


cout << "Please enter your choice ";
cin >> letter;

if (letter == 'A')
{
cout << "How many 2 X 6 X 4 boxes would you like to purchase with Express shipping? ";
cin >> number;
double atotal = number * a;
cout << "Your total is $" << fixed << setprecision(2) << atotal << endl;
}

if (letter == 'B')
{
cout << "How many 2 X 10 X 4 boxes would you like to purchase with Express shipping? ";
cin >> number;
double btotal = number * b;
cout << "Your total is $" << fixed << setprecision(2) << btotal << endl;
}

if (letter == 'C')
{
cout << "How many 6 X 8 X 8 boxes would you like to purchase with Express shipping? ";
cin >> number;
double ctotal = number * c;
cout << "Your total is $" << fixed << setprecision(2) << ctotal << endl;
}

if (letter == 'D')
{
cout << "How many 10 X 12 X 4 boxes would you like to purchase with Express shipping? ";
cin >> number;
double dtotal = number * d;
cout << "Your total is $" << fixed << setprecision(2) << dtotal << endl;
}

if (letter == 'E')
{
cout << "How many 14 X 16 X 2 boxes would you like to purchase with Express shipping? ";
cin >> number;
double etotal = number * e;
cout << "Your total is $" << fixed << setprecision(2) << etotal << endl;
}

if (letter == 'F')
{
cout << "How many 18 X 20 X 6 boxes would you like to purchase with Express shipping? ";
cin >> number;
double ftotal = number * f;
cout << "Your total is $" << fixed << setprecision(2) << ftotal << endl;
}
}

}
change
if ( shipping == '3-Day')
to
if ( shipping == "3-Day")

Last edited on
THANK YOU SO VERY MUCH! I really appreciate it!!!!

I was gonna use a workaround of:

char shipping;
cout << "Would you like 3-Day shipping or Express shipping(T/E)?";
cin >> shipping;

if (shipping == 'T')

So thank you very much!!!!
your welcome :) good luck!
Topic archived. No new replies allowed.