our prof ask us to fill the in the following functions:
-string makeLine(int length)
-string makeIncreasingPart(int rows)
-string makeDecreasingPart(int rows)
-string makeTriangle(int width)
> but something is not right here
you need to be more specific
the program freezes
running through a debugger (^C is a manual interrupt)
$ gdb a.out
> run
^C
> backtrace
#0 0x00007ffff7279999 in brk () from /usr/lib/libc.so.6
#1 0x00007ffff7279a79 in sbrk () from /usr/lib/libc.so.6
#2 0x00007ffff7215e19 in __default_morecore () from /usr/lib/libc.so.6
#3 0x00007ffff720fdda in systrim.isra () from /usr/lib/libc.so.6
#4 0x00007ffff7210ff7 in _int_free () from /usr/lib/libc.so.6
#5 0x0000000000401148 in makeDecreasingPart[abi:cxx11](int) (rows=5) at foo.cpp:30
#6 0x0000000000401789 in testMakeDecreasingPart () at foo.cpp:64
#7 0x0000000000401bd4 in runTests () at foo.cpp:82
#8 0x0000000000401c06 in main () at foo.cpp:88
> frame 5
#5 0x0000000000401148 in makeDecreasingPart[abi:cxx11](int) (rows=5) at foo.cpp:30
30 result = result + makeIncreasingPart(currentRow) + "\n";
(gdb) list
25
26 string makeDecreasingPart(int rows) {
27 string result = "";
28 int currentRow = 5;
29 while(currentRow <= rows) {
30 result = result + makeIncreasingPart(currentRow) + "\n";
31 currentRow--;
32 }
33 return result;
34 }
there is the culprit code that's causing an infinite loop.
the string makeDecreasingPart and string makeTriangle codes i put weren't right i guess. that's why I'm asking for help because i did everything already and i can't still figure out whats the right code to put.