If statement

Hello,
First thing you should know: I am an almost total beginner in C++, as I already had trouble with what to type for the title of the topic. But this is obvious as I am posting to the "Beginners" section.

Basically, I'm having problems with this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
using namespace std;

int main()
{
	srand ( time(NULL) );

	int result;
	result = rand() % 3+1;
	cout << result << endl;

	{
		if (result = 1)
		cout << "aaaa";
		
		else if (result = 2)
			cout << "bbbb";
			
		else if (result = 3)
				cout << "cccc"; 
	
	}

	cin.get();
	return 0;
}


I want it to display a different message for every randomly generated result.
This seems not to work however, and only displays result for number 1, even though the result may be 2 or 3. If it's necessary to know, then the "aaaa", "bbbb", "cccc" are actually multiple lines of text. I doubt it'll help though.

So, what should I do?
Fixed it!
Forgot to put double "=" to if statements.

*sigh* I'm such a noob...
Topic archived. No new replies allowed.