0

I've looked over some of the other threads and I am still puzzled.

I keep getting an error: expected expression for line 21:5 (the ending curly bracket for my do loop). Here's my code so far:

#include <stdio.h>
#include <cs50.h>

int rows;
int main(void)

{
    do
    {
      printf("Height: ")
      rows = GetInt()
    }
  while (rows > 23 || rows < 1);

  int hash = 2;
  int spaces = 22;
  int x;

  for (x = 0; x < rows; x++);
    {
      printf(" " * spaces, int);
      printf("#" * hash, int);
      printf("\n");
      // subtract 1 space and hash from each line after initial line
    }
}

I am still wrestling with the code to build the pyramid so no questions there. Any thoughts about that curly bracket issue? Thanks!

0

Did you forget anything, like maybe a couple of semicolons?

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

| improve this answer | |
  • Thanks! I added semicolons to the ends of my statements in the do loop. – Lee Gainer Nov 10 '16 at 19:01

You must log in to answer this question.

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