Howdy, Stranger!

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

Categories

Some questions about multiple subscripted arrays

MastergabeMastergabe Member Posts: 3
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

  • mfeikmfeik Member Posts: 24
    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.
    :



  • MastergabeMastergabe Member Posts: 3
    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.
    : :
    :
    :
    :
    :

  • mfeikmfeik Member Posts: 24
    : 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!

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    _ [ http://forcoder.org ] free video tutorials and ebooks about \ Java, Python, Objective-C, C#, Delphi, C++, JavaScript, Visual Basic .NET, C, Go, Ruby, Assembly, PHP, Swift, Visual Basic, Scratch, MATLAB, PL/SQL, R, Perl Clojure, Hack, Crystal, Rust, Bash, Ada, Fortran, Transact-SQL, ABAP, LabVIEW, FoxPro, Lisp, Scheme, Kotlin, Prolog, SAS, Julia, Logo, ML, Awk, Alice, Scala, VBScript, D, Dart, Erlang, COBOL, Lua, Apex, F# \ _

Sign In or Register to comment.