Skip to content

Commit 59112c1

Browse files
committedOct 7, 2019
Reduces number of lines
1 parent 92c313f commit 59112c1

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed
 

‎PROG2/arrays.cc

+2-11
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ int countRangeValues(double myArray[], int numItems, double toCount)
1919
int count = 0;
2020
double lowerBound = toCount - 0.5;
2121
double upperBound = toCount + 0.5;
22-
for (int i = 0; i < numItems; i++)
23-
{
24-
if (myArray[i] >= lowerBound && myArray[i] < upperBound) count++;
25-
}
22+
for (int i = 0; i < numItems; i++) if (myArray[i] >= lowerBound && myArray[i] < upperBound) count++;
2623
return count;
2724
}
2825

@@ -40,13 +37,7 @@ double getMaxAbsolute(double myArray[], int numItems)
4037
maxAbsolute = -max;
4138
}
4239
}
43-
else
44-
{
45-
if (myArray[i] >= maxAbsolute)
46-
{
47-
max = maxAbsolute = myArray[i];
48-
}
49-
}
40+
else if (myArray[i] >= maxAbsolute) max = maxAbsolute = myArray[i];
5041
}
5142
return max;
5243
}

0 commit comments

Comments
 (0)
Please sign in to comment.