So for my [string makeDecreasingPart(int rows)], I get error.
C:\Users\jaebo\Downloads\lab-8.5>a.exe
Assertion failed: makeDecreasingPart(5) == "*****\n****\n***\n**\n*\n", file triangle.cpp, line 75
Ok, lets look at the code and think through, what happens on a "simpler" makeDecreasingPart(1) case:
1 2 3 4 5 6 7 8 9 10 11
string makeDecreasingPart(int rows)
{
string result = "";
int curRow = 1;
while(curRow <= rows)
{
result = result + makeLine(curRow) + "\n";
curRow--;
}
return result;
}
Line 1: rows==1
Line 4: curRow==1
Line 5: 1<=1 is true
Line 7: result=="*\n"
Line 8: curRow==0
Line 5: 0<=1 is true
Line 7: result=="*\n\n"
Line 8: curRow==-1
Line 5: -1<=1 is true
Line 7: result=="*\n\n\n"
Line 8: curRow==-2
...
That is a long loop.
You have to rethink the initial value of curRow and the condition that ends the loop.