im trying to show what is stored in arrays, basically to make sure my program is working fine, i have got it to print which element in the array it is, but how do u access the array and show what value is stored in it. my code is basically

for(int i = 0; i < 16; i++) 
            {
                for(int j = 0; j < 60; j++)
                {          
                    cout << endl << "string " << i << "weights " << j;  
                }
            }

i know this will only print the value of whatever j is. not what is stored in element j.

any help will be greatly appreciated?

im trying to show what is stored in arrays, basically to make sure my program is working fine, i have got it to print which element in the array it is, but how do u access the array and show what value is stored in it. my code is basically

for(int i = 0; i < 16; i++) 
            {
                for(int j = 0; j < 60; j++)
                {          
                    cout << endl << "string " << i << "weights " << j;  
                }
            }

i know this will only print the value of whatever j is. not what is stored in element j.

any help will be greatly appreciated?

This is most confusing, are you saying you have 2 arrays called i and j as well as using i and j as loop counters!!!! Here's an example i suggested you look through it

int age[] = {3, 67, 234, 34};
for(int i = 0; i < 4; i++) {
        cout << "Age: " << age[i] << std::endl;
}

Chris

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.