0

I'm trying to check my Mario code and seem to be getting this issue:

jharvard@appliance (~): check50 2014.fall.pset1.mario mario.c
Compressing mario3.c... Compressed.
Uploading...... Uploaded.
Checking..... server responded with status code 400. Try again later!

I'm hooked up to the internet, my mario.c is in the default directory, so is something broken on CS50's end?

Barring a solution, my code works:

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

int main(void)

{

int x, y, z;

do
{
    printf("Please select a number between 1 and 23: ");
    x = GetInt(); //This is the input number.
}
    while (x <= 0 || x>23); //Keep requesting so long as it's smaller than 1 OR greater than 23.

    y = x -1;
    z = 1;

for (int i = x; x > 0; i++) //For loops require this int. I've seen it as i--, but it works with i++ and other literature supports the ++.

{
    for (int i = 0; i < x; i++) //This is space from left side of the pyramid. This has to do with the spacing of the spaces and bars. When x>0 is i <= z, it slumps to the left.

    {
    printf(" "); //This is the space in the pyramid
    }

    for (int i = 1; i <= z; i++) //This is space from the right.
{
printf("#"); //this is the brick printing part!
}

printf("#\n"); //This is how you get that second # without having too much of an issue. 

x--; //You NEED these in this code, otherwise they never terminate and you have ##'s EVERYWHERE.
z++; //You NEED these in this code, otherwise they never terminate and you have ##'s EVERYWHERE.

 return 0; //You NEED these in this code, otherwise they never terminate and you have ##'s EVERYWHERE.

 }

Can anyone confirm that even though mine works that it isn't missing anything?

Thanks!

1
  • 1
    Are you sure you are in the correct folder? I see from your terminal that you are on the home folder ~ while you should be on ~/Dropbox/pset1 probably. Or any other folder you have created for the pset.
    – ChrisG
    Aug 1, 2015 at 8:19

1 Answer 1

1

Just run mine using the following command getting the wanted result.

jharvard@appliance (~/Dropbox/pset1): check50 2014.fall.pset1.mario mario.c
:) mario.c exists
:) mario.c compiles
:) rejects a height of -1
:) handles a height of 0 correctly
:) handles a height of 1 correctly
:) handles a height of 2 correctly
:) handles a height of 23 correctly
:) rejects a height of 24
:) rejects a non-numeric height of "foo"
:) rejects a non-numeric height of ""
https://sandbox.cs50.net/checks/c2d4738f4a8b48efbdec6262503xxxxx
2
  • Hi Chris, Unfortunately running this code (the mario.c was in the dropbox) repeated the same server issue. Luckily, the results that you posted to check against worked (Ie, the questions generated the expected answers), so I'm not really sure what went sideways? Aug 3, 2015 at 6:38
  • So did you run check50 and everything went ok?
    – ChrisG
    Aug 3, 2015 at 7:35

You must log in to answer this question.

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