Some questions about multiple subscripted arrays

Hello I have to answer some questions but i'm kinda stuck in these ones. Could someone help me please??
Consider a 2-by-3 integer array t
h) Write a series of statements that initialize each element of t to zero. Do not use a loop
j) Write a statement that inputs the values for the elements of t from the terminal
k) Write a series of statements that determine and print the smallest value in array t.
l) Write a statement that displays the elements of the first row of t
m) Write a statement that totals the elements of the fourth column of t
n) Write a series of statements that prints the array t in neat, tabular format. List the column subscripts as headings across the top and list the row subscripts at the left of each row.

Comments

  • Far beit from me to do anyones homework (lest you get asked a similar question on a test, but this might get you started...

    a 2x3 array is declared as:
    int iArray[2][3];
    if you wanted to access the first value in the array the format is:
    iArray[0][0]
    therefore it follows that to initialize an element to zero, you would need this type of statement
    iArray[index][index] = 0; // where index = the location of interest.
    If you need more help just ask - and post what code you have done so far (like I said - help - not going to do your homework but I don't mind 'helping')
    Regards
    -Mel

    : Hello I have to answer some questions but i'm kinda stuck in these ones. Could someone help me please??
    : Consider a 2-by-3 integer array t
    : h) Write a series of statements that initialize each element of t to zero. Do not use a loop
    : j) Write a statement that inputs the values for the elements of t from the terminal
    : k) Write a series of statements that determine and print the smallest value in array t.
    : l) Write a statement that displays the elements of the first row of t
    : m) Write a statement that totals the elements of the fourth column of t
    : n) Write a series of statements that prints the array t in neat, tabular format. List the column subscripts as headings across the top and list the row subscripts at the left of each row.
    :



  • Hi again i'm still stuck on this. I managed to do some of the questions but i don't know how to do these three.
    k) Write a series of statements that determine and print the smallest value in array t.
    l) Write a statement that displays the elements of the first row of t
    m) Write a statement that totals the elements of the fourth column of t
    Hmm for question l i did this
    cout << t[0][0] << t[0][1] << t[0][2] << endl;
    but it's probably wrong tell me if this would work. I don't really know what question m means totals the elements? Isnt there 3 columns in a 2 by 3 array how can there be a fourth column? And question k I can't figure how to do that any ideas?

    : Far beit from me to do anyones homework (lest you get asked a similar question on a test, but this might get you started...
    :
    : a 2x3 array is declared as:
    : int iArray[2][3];
    : if you wanted to access the first value in the array the format is:
    : iArray[0][0]
    : therefore it follows that to initialize an element to zero, you would need this type of statement
    : iArray[index][index] = 0; // where index = the location of interest.
    : If you need more help just ask - and post what code you have done so far (like I said - help - not going to do your homework but I don't mind 'helping')
    : Regards
    : -Mel
    :
    : : Hello I have to answer some questions but i'm kinda stuck in these ones. Could someone help me please??
    : : Consider a 2-by-3 integer array t
    : : h) Write a series of statements that initialize each element of t to zero. Do not use a loop
    : : j) Write a statement that inputs the values for the elements of t from the terminal
    : : k) Write a series of statements that determine and print the smallest value in array t.
    : : l) Write a statement that displays the elements of the first row of t
    : : m) Write a statement that totals the elements of the fourth column of t
    : : n) Write a series of statements that prints the array t in neat, tabular format. List the column subscripts as headings across the top and list the row subscripts at the left of each row.
    : :
    :
    :
    :
    :

  • : Hi again i'm still stuck on this. I managed to do some of the questions but i don't know how to do these three.
    : k) Write a series of statements that determine and print the smallest value in array t.
    : l) Write a statement that displays the elements of the first row of t
    : m) Write a statement that totals the elements of the fourth column of t
    : Hmm for question l i did this
    : cout << t[0][0] << t[0][1] << t[0][2] << endl;
    : but it's probably wrong tell me if this would work. I don't really know what question m means totals the elements? Isnt there 3 columns in a 2 by 3 array how can there be a fourth column? And question k I can't figure how to do that any ideas?
    :
    : : Far beit from me to do anyones homework (lest you get asked a similar question on a test, but this might get you started...
    : :
    : : a 2x3 array is declared as:
    : : int iArray[2][3];
    : : if you wanted to access the first value in the array the format is:
    : : iArray[0][0]
    : : therefore it follows that to initialize an element to zero, you would need this type of statement
    : : iArray[index][index] = 0; // where index = the location of interest.
    : : If you need more help just ask - and post what code you have done so far (like I said - help - not going to do your homework but I don't mind 'helping')
    : : Regards
    : : -Mel
    : :
    : : : Hello I have to answer some questions but i'm kinda stuck in these ones. Could someone help me please??
    : : : Consider a 2-by-3 integer array t
    : : : h) Write a series of statements that initialize each element of t to zero. Do not use a loop
    : : : j) Write a statement that inputs the values for the elements of t from the terminal
    : : : k) Write a series of statements that determine and print the smallest value in array t.
    : : : l) Write a statement that displays the elements of the first row of t
    : : : m) Write a statement that totals the elements of the fourth column of t
    : : : n) Write a series of statements that prints the array t in neat, tabular format. List the column subscripts as headings across the top and list the row subscripts at the left of each row.
    : : :
    : :
    : :
    : :
    : :
    :
    :

    if you got questions h & j... how are you still having problems... post your code as you have it so far and maybe I can offer you a pointer or three
    Regards
    -Mel

    -------------------------------------------

    Of all the things I've lost, I miss my mind the most!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories