samedi 27 avril 2019

I need help two dimensional array

Here is what I have so far:

include

include

using namespace std;

int main()

{

int sumCount[6][6];

for (int i = 0; i < 6; i++)

{

for (int j = 0; j < 6; j++)

{

sumCount[i][j] = 0;

}

}

char ch='Y';

srand(time(NULL));

while (ch == 'Y' || ch =='y')

{

int dice1 = rand() % 9 + 4;

int dice2 = rand() % 9 + 4;

sumCount[dice1 - 4][dice2 - 4] += 1;

cout << "do you want to dice more enter (Y/N): ";

cin >> ch;

}

cout << "\t4\t5\t6\t7\t8\t9" << endl;

for (int i = 0; i < 6; i++)

{

cout << i+4 << "\t";

for (int j = 0; j < 6; j++)

{

cout << sumCount[i][j] <<"\t";

}

cout << endl;

}

system("pause");

return 0;

}

Aucun commentaire:

Enregistrer un commentaire