I am trying to fiqure out this problem for a long time. I am teaching myself C++ from C++ for Dummies and I cant figure this out.

Fill in a 2 dimension 3x3 array with odd numbers. The display shows the array as it is being filled. Use random integers to fill the array. Use numbers between 1 and 10. Initialize array to zero. Find the sum of matrix. Find the maximum number in the matrix and the number of times it occurred. Can anyone show me a code that does this?

9 Years
Discussion Span
Last Post by Aranarth

OK, you've listed a handful of different things your program is supposed to do.

Can you do ANY of them, at all?

Show us how far you've got and a specific question about what to do next, don't just post "gimme the answer" then bump it with a useless "does anyone know".

void BuildRndList( unsigned array[], const unsigned size,
const unsigned OtherIDs, const unsigned OtherIDamt ){

if (seeded == false) RNDseed();
// set array to all '0'
for ( unsigned i = 0; i < size; i++ ) array = 0;
for ( unsigned i = 1; i <= OtherIDs; i++) {
for (unsigned j = 0; j < OtherIDamt; j++) {
bool loop = true;
const unsigned RNDnum = RNDgen(size);
if ( array[RNDnum] == 0 ) {
array[RNDnum] = i;
loop = false;

Edited by happygeek: fixed formatting


This thread is nearly three years old, just saying.

int i,k=0,j;
int a[3];
int b[3];
int c[6];
bool flag;

Uh? Sometimes I just don't get what people are thinking...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.