Timeline for mario.c check50 says I get the correct output for inputs of 0, 23 and 24, but not for 1 and 2?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 17, 2016 at 19:58 | vote | accept | allyballybee | ||
Mar 17, 2016 at 10:07 | comment | added | allyballybee | I should also say that I want to understand this rather than just getting the answer through trial and error. I feel thought that the code should have something to do with filling in columns, so that the columns are what the condition is based on, rather than the rows - does that make sense? maybe i am not cut out for coding - but paradoxically i have enjoyed this so far - i am just stuck! | |
Mar 17, 2016 at 10:04 | comment | added | allyballybee | Thanks again @CliffB. I have played about with the problem line and i think i am fundamentally confused about this. I can get a pyramid that is left aligned using for '(int spaces = 0; height-1 < rows ; spaces --)' but don't get how to specify the spaces to go backwards - so that there are no spaces on the bottom row. it works if i use (int spaces =height; spaces-1<rows; spaces --). Is it ok for int spaces to equal something that is variable? why do i have to change height in the condition to be spaces? sorry for the hassle and thanks for the help. | |
Mar 16, 2016 at 19:03 | comment | added | allyballybee | Thanks for this I will check the code again. I now get that it doesn't print out 24 chars in each row and that the last row of each pyramid has no leading spaces, so i need to figure out how many leading spaces there are on the rows above the last....This is really tricky but I think I am overthinking it | |
Mar 16, 2016 at 18:44 | history | answered | Cliff B | CC BY-SA 3.0 |