0
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])

         {
                    increase++;
                    return Up;
         }

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

              return Down;

         }

         else;



        }//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.

2
Contributors
1
Reply
14
Views
3 Years
Discussion Span
Last Post by tinstaafl
0

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.

Edited by tinstaafl

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.