change a value in an array

How can i change a specific value in an array, if there is already a value at that location?

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
int corchoice, k, l, i ,j;
for (i = 6; i >= 0; i--)
	{ 
		cout << endl;
		for (j = 0; j < maxc; j++)
		{
			if (np[i][j] == -1)
				cout << "   ";
			else
				cout << setw(6) << np[i][j];
		}
	}

	cout << endl << "Is this pyramid correct?(yes = 1/no = 2)" << endl;
		cin >> corchoice;

		while (corchoice != 1)
		{
		cout << "please enter the row of the incorrect number." << endl;
		cin >> k;
		cout << "please enter the column of the incorrect number." << endl;
		cin >> l;
		cout << "Please enter a integer for the array number: " << "[" << k << "]" << "[" << l << "]" << endl;
		cin >> np[k][l];
		cout << endl;

for (i = 6; i >= 0; i--)
	{ 
		cout << endl;
		for (j = 0; j < maxc; j++)
		{
			if (np[i][j] == -1)
				cout << "   ";
			else
				cout << setw(6) << np[i][j];
		}
	}

		cout << endl;
		cout << "Is this pyramid correct?(yes = 1/no = 2)" << endl;
		cin >> corchoice;
		}
After printing the array again, no values are changed.
Last edited on
Topic archived. No new replies allowed.