Halp

Pages: 12
single = is an assignment operator
double == is an equality operator


if you used if (country = "usa") then you would assign usa to country rather then check to see what its value is and if it matches "usa".

*Edit Nisheeth is faster poster then me.
Last edited on
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <string>
#include <fstream>
#include <windows.h>
#include <time.h>
#include <cstdlib>
#include <iostream>

using namespace std;
int choice;


int player,nukes,votingpower,usa,china,russia,northk,iran,france;


int main ()
{
	cout << "Pick a country.\n";
	cout << " 1. usa\n2. france\n3. china\n4. russia\n5. northk\n6. iran\n";
	cin>> choice;
	switch( choice )
	{
	case 1:
		nukes=1000;
		votingpower=10;
		cout<< "You have picked America.\n";

		break;
	case 2:
		nukes = 500;
		votingpower=15;
		cout<<"You have picked China.\n";
		break;
	case 3:
		nukes = 2000;
		votingpower=5;
		cout << "You have picked Russia.\n";
		break;
	case 4:
		nukes=200;
		votingpower=5;
		cout << "You have picked France.\n";
		break;
	case 5:
		nukes = 1000;
		votingpower=2;
		cout << "You have picked North Korea.\n";
		break;
	case 6:
		nukes=0;
		votingpower=1;
		cout << "You have picked Iran.\n";
		break;
	}


	cin.get();
	cin.get();
	return 0;

}
closed account (Dj15fSEw)
Alright, thanks guys. :D
Topic archived. No new replies allowed.
Pages: 12