If you haven't watched the walkthrough video for this assignment - definitely do that now - it's very good.
According to the example in the video, the number of hashes starts with two and increases by one each time. You can figure out how many hashes to print on the nth row, by knowing only the row number n. On the first row, you print 2 hashes, on the second row you print 3 hashes, etc... You are always printing one more hash than the row number.
In your code for the hashes:
for (int h = 0; h < height + 1; h++)
{
printf("%s", "#");
}
height
is the same value every time through the loop, so your loop will ALWAYS print the same number of hashes for each row. You should be comparing h
to the row number i
- to print out one more hash than the row number. And don't forget that i
starts at 0 and the rows in the video start at 1.