Adding in While loop

I am in the process of creating a game that has two players machine and person. The player is selected randomly each round. So if the player is selected, he needs to choose a number from 1-9. Then the machine needs to choose another new number either in the same row or colunm.(i figured out how to check against col.and row). Then keep going until someone reaches 31.

I´m stuck on how to add the numbers from previous rounds and have them reflect in the new rounds. While at the same time using the last entered number(ultimo) as a reference has to whether or not the new number is valid.

Ok I created a while loop as suggested. But it is not adding each round like it should. So the question is: What is wrong with the code after the while loop?

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
  while ((x != 0) && (suma < Meta)){
		
		
		
		
		cout << "SUM =" << x + last number << endl;
		
		
		
		if (player == Person) {
		
		x = machinerandomnDigit(last number);
		sum = sum + x;
		player = Person;
		last number = x;





		}

		else {

			x = machinerandomDigit(ultimo);
			sum = sum + x;
			player = Person;
			last number = x;
		}



	}
	
	
	
	

		cin.sync();
		cin.get();
		system("pause");
		return whoStarts();
Theres not enough code to see what the problem is.
Topic archived. No new replies allowed.