Hello,
This is my first post at the forum and I'm looking forward to a good experience.
I'm having some trouble with something that I'm pretty sure is really simple. I'm just starting to learn C++ and I'm using Visual C++ 2008 Express Edition.

My program is supposed to first ask the user if he would like to find out the area of a triangle if the user puts in say 0 and Ive predefined that 0 is a no which would make the compter display Too Bad

If the person types 1 and hits enter he would be asked for the length and width then the area will be displayed.
The thing is no matter what I do it always goes for yes.

This is the code:

/* A program designed to calculate the area of a rectangle */

#include <iostream>
using namespace std;

int main ()

{
int length, width, a;

cout << "Would you like to calculate the area of a rectangle?\n";
cout << "Type 1 for yes and 0 for no";
cin >> a;

if(a = 0) {
cout << "Too bad";
}

if(a = 1) {
cout << "Enter the length: ";
cin >> length;

cout << "Enter the width: ";
cin >> width;
cout << "The area is ";
cout << length * width ;
}


return 0;

}