0

Following it's analysis where it says my program is wrong, yet it is as it should, also there is nothing after the "#":

:( handles a height of 1 correctly expected "# #\n", not "# # \n"

:( handles a height of 2 correctly expected " # #\n## ##\n", not " # # \n## ##..." Expected Output: # #

#

Actual Output: # #

##

the same for 23.

:( rejects a height of 24, and then accepts a height of 2 expected " # #\n## ##\n", not " # # \n## ##..." (there are no spaces after the "#".

link: https://cs50.me/submit50/results/rickcleansoul/375fbc56b9fbf440d5246c048467cd7fa56c4e64 Thank you.

2

You should not have spaces after your last hash of the line. Made this mistake myself, trying to make it symmetric I added the same spaces as on the front (you seem to even add space(s) for height 1, which requires only the two spaces between the half-pyramids). But the last hash should be immediately followed by the newline '\n', no space(s) between.

2
  • no, I did not add any spaces, because they aren't necessary. any other idea? the new line goes as the loop is over. the worst thing is it works perfect on the pc. – Ricardo Martinelli Apr 25 '18 at 17:05
  • If check50 says there is a single space at the end of the first line, then I would say that there definitely is one. The check50 code is too well tested for it to give a false fail. The only way to settle this would be to analyze the actual code. Try this: in your code, change any printf statement to print a ! instead of a space and see what happens. Also, pay close attention to the printf that handles the \n. For instance, is it "\n" or " \n"? (note the space before the slash) – Cliff B Apr 25 '18 at 18:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .