0

:) mario.c exists. :( mario.c compiles. expected exit code 0, not 1 :| rejects a height of -1 can't check until a frown turns upside down :| handles a height of 0 correctly can't check until a frown turns upside down :| handles a height of 1 correctly can't check until a frown turns upside down :| handles a height of 2 correctly can't check until a frown turns upside down :| handles a height of 23 correctly can't check until a frown turns upside down :| rejects a height of 24, and then accepts a height of 2 can't check until a frown turns upside down :| rejects a non-numeric height of "foo" can't check until a frown turns upside down :| rejects a non-numeric height of "" can't check until a frown turns upside down

Here are actually the code:

include

include

int main (void) { int n; do { printf("height:"); n = Getint(); } while (!(n>=0 && n<=23));

for (int i=0;i<n;i++)
{
for (int k=n-i-1;k>0;k--)
printf (" ");

for (int j=i+2;j>0;j--)
printf ("#");

printf ("\n");
}

Could someone help me please with errors displayed in my check?

1 Answer 1

1

You've got Getint() when you should have get_int().

If your program doesn't compile when you run make mario, there is no point in running check50 on it. You should be testing your code yourself by compiling and running it with various inputs before you run check50.

2
  • In fact my program does compile and provides results during testing it (by input). However when I try to check it through cs50 machine (answering the test in cs50 online course) it outputs errors stated above. I'm using 2014 version of CS50 Appliance (as far as I understand get_int() function is available in latest version). By the way sandbox.cs50.net doesn't work, what could be wrong with it? Commented Feb 13, 2018 at 17:40
  • Both the appliance and sandbox were deprecated several years ago and are no longer supported. You're also using Getint() which, in the old library, should be GetInt() (with a capital I). I'd suggest moving to the CS50 IDE.
    – curiouskiwi
    Commented Feb 13, 2018 at 21:29

You must log in to answer this question.

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