Answer on Question#39109 - Programming – C++
#include <iostream>
#include <stdlib.h>
using namespace std;
#define A 14.95
#define T 10.25
#define R 8.75
#define H 25.99
int main()
{
char c;
cout << "Input shipping method (a,t,r,h): ";
c = cin.get();
cout << "The shipping rate is: ";
switch (c)
{
case 'A':
case 'a':
cout << A;
break;
case 't':
case 'T':
cout << T;
break;
case 'r':
case 'R':
cout << R;
break;
case 'h':
case 'H':
cout << H;
break;
default:
cout << "you've inputted wrong shipping method";
break;
}
cout << "\n";
system("PAUSE");
return 0;
}
Comments