rows and columns 0 and 1 not printing

i'm trying to animate the game of life, with asterisks, but the code i have won't print the asterisks in rows or columns 0 and 1. every other asterisk prints as it should and i can't figure out whats going 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
  #include <iostream>
#include <time.h>
using namespace std;

void afficher(short T[][40]) //prints the table 
{

for (short rangée = 0; rangée <= 29; rangée++) //rows
	{
		for (short colonne = 0; colonne <= 39; colonne++) //columns
			if (T[rangée][colonne] == 0)
				cout << ' ';
			else
				cout << '*';
		cout << endl;
	}
	cout << endl;
}

int main()
{
		short T[30][40] = { 0 };
		short CellulesInitiales; //initial cells
		cout << "Combien de cellules sont initialment vivantes? "; //how many cells are alive to begin with?
		cin >> CellulesInitiales;
		for (int i = 0; i < CellulesInitiales; i++)
		{

			cout << "Entrer les coordinees de la cellule vivante #" << i + 1 << endl; //enter coodinates of living cell #i+1
			short C, R;
						cin >> C;
						cin >> R;
						T[C][R] = 1;
				}
		afficher(T);
		system("pause");

		return 0;
	}
Last edited on
I checked it and got this output:
Combien de cellules sont initialment vivantes? 3
Entrer les coordinees de la cellule vivante #1
0
0
Entrer les coordinees de la cellule vivante #2
1
0
Entrer les coordinees de la cellule vivante #3
0
1
**                                      
*
So I don't see the problem?
whatttttt
it must have been the compiler then?

okay, I copied the code back into visual studio and it seems to work fine. I guess I'll never know...
Topic archived. No new replies allowed.