if(company[i][j] < 0)
{
    loss = loss++;
}
else

//Im trying to Get the number of losses and not the actual input numbers"for example loike 1 loss, 2 loss etc

What is contained in company[i][j] there isn't a lot to go on from this.

its a array that is used to input values

The only thing I see is that loss = loss++; is redundant. loss++; does the same thing. Other than that if company is an array of int, double, etc. and any value less than 0 indicates a loss, 2 loops will iterate through the array and get the total you're looking for. Something like:

for(int i = 0; i < row_size; i++)
{
    for(int j = 0; j < column_size; j++)
    {
        if(company[i][j] < 0)
        {
            loss++;
        }
    }
}
cout << loss << " losses\n";

row_size and column_size are the number of elements in each part of the array.

On a side note thinking in terms of rows and columns can make it easier for some people to grasp this kind of array structure.

ok thanks i actually got it, all i was missing was a statement like loss =0; fo each like it would just pick up the losses and increment back to 0 each time, instead of continually incrementing

Glad you got it. Please remember to mark this solved thanks.

Thanks alot for our response and time, i really apprciate it!

Be a part of the DaniWeb community

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