Linux.com

Answers
  • Do you means array of number (integer))? If so, perhaps your array should be look like this in C/C++:

    int num[5][5] =
    {
    { -1, 12, 23, 4, 15 },
    { 16, 57, -8, 19, 0, },
    { 14, 22, -13, -14, 55 },
    { 10, 0, 2, 1, 20 },
    { 11, 22, -23, 14, 96 }
    };

    This is a 5x5 array of int, To determine the minimum value of 3rd row, you can use this loop:

    int i, a, b;

    a = num[2][0];
    for (i = 1; i < 5; i++) {
    b = num[2][i];
    if ( a > b)
    a = b;
    }

    after the loop end, the minimum value is now stored in a, and so with to find maximum value in a column, just change the row index and a more than '>' to less than '>'. Remember that C/C++ array always indexed from 0.

    a = num[0][1];
    for (i = 1; i < 5; i++) {
    b = num[i][1];
    if (a > b)
    a = b;
    }

    Unfortunately i don't understand with 'triangle', but i hope this example give you a point to start.... AND I CAN'T WRITE CORRECT CODES HERE :( because it maybe re-formatted by this text-form.

    Answered by ajhwb
    5 years ago
    0 1
  • nope ;)

    Answered by ajhwb
    5 years ago
    0 0
  • Hi Ardhan Madras ..and thanks for your answer .but when i try to run this program"with the Code Blocks compiler" an error message appears pointing to the statement
    b=num[2]; saying that{ invalid conversion from int * to int}
    so why is that? also there must be 2 loops instead of one ?

    Answered by linuxstarr
    5 years ago
    0 0
  • the text from don't allow me to write such code, so use this link:

    [url]http://pastebin.com/vZ6yhhT3[/url]

    I will recomendeed you first to learn how to compile a program by not using an IDE such code::block, try to compile your code from command line, see your compiler documentation. That will help you to understand about the compiler and compilation itself.. good luck!

    Answered by ajhwb
    5 years ago
    0 1
  • Why does this sound an awful lot like a homework assignment?

    Answered by gomer
    5 years ago
    1 0
  • I think Adam is right ;)

    Answered by kunal
    4 years ago
    0 0
Please register/login to answer this question. Click here to login
Questions from category Internet

Upcoming Linux Foundation Courses

  1. LFS230 Linux Network Management
    06 Oct » 09 Oct - Virtual
    Details
  2. LFD331 Developing Linux Device Drivers
    13 Oct » 17 Oct - Virtual
    Details
  3. LFS430 Linux Enterprise Automation
    13 Oct » 16 Oct - Virtual
    Details

View All Upcoming Courses

Community Answers - Search


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board