string steady(int company[][column], int row)//Question 6

    int increase = 0;
    int x,y = 0;

    string Up = "Increased";
    string Down = "Decreased";

        for(y = 0; y < 2; y ++)//column
    {//Start loop

        increase = company[0][y];

        for(x = 1; x < 4; x ++)//Rows

         if(increase < company[x][y])

                    return Up;

         else if (increase > company[x][y])

              return Down;



        }//End for loop

//Hey guys im trying to determine for 2 items, if they were steadily increasing( each quarter which is 4 had a profit higher than the previous quarter) steadily decreased or it went up or went down.

Re: 2D array C++ comparing Columns 80 80

What is the routine doing or not doing, that you want fixed. Also how is your array structured, what does each row and column mean?

If I read your question right, you might need to rethink your approach. Since you're only comparing 4 quarters, compare the first and last quarter and get a net change, now if the 2 intermediate quarters have a change in the same direction you have steady progression. To refine it even further you can check if the individual changes fall within a certain range something like average change plus or minus 5.

Be a part of the DaniWeb community

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