switch statement

I'm trying writing a program that someone enters a code for tv = t, new release = n, non-new releases = m. If they enter either one of the first two they will get free for tv and 6.99 for new releases. If they enter m they get prompted to enter year. depending on the year entered they would get a certain price. Now the first if statement works fine but at the switch, it doesn't it just defaults to 5.99. What am I missing or not seeing?

<include <iostream>
<include <string>

using namespace std;

int main()
{
char code, A, B, C;
string title;
int year;

A = year < 1960;
B = 1960 <= year < 1979;
C = 1980 <= year < 1999;
code = 't', 'n', 'm';

cout << "Enter Title: " ;
cin >> title ;
cout << "Enter Code: " ;
cin >> code ;

if ( code == 't' )

cout << "Free" << endl ;

else if ( code == 'n' )

cout << "$6.99" << endl;

else
cout << "Enter year: " ;
cin >> year ;

switch (code)
{
case 'A':
year = year < 1960;
cout << "$2.99" ;
break;

case 'B':
year = 1960 <== year < 1979;
cout << "$3.99";
break;

case 'C':
year = 1979 <== year < 1999;
cout << "$4.99";
break;

default:
cout << "5.99";

}

return 0;

}
Topic archived. No new replies allowed.