random function

is the commented part correct

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
	compuer = 1+(rand() % 3);// is this part correct
		
		if (computer == 1)
		{
			com_choice = 'R';
		}
		
		else if (computer == 2)
		{
			com_choice = 'P';
		}
			
		else
		{
			com_choice = 'S';
		}
		return com_choice;
}
If you want to assign 1, 2 or 3 to the compuer variable it is correct.
Yes
No, you mis-spelled "compuer", I'm guessing it should be "computer"?
Yes lol
Topic archived. No new replies allowed.