Hi,
I'm running mario-more (which behaves as expected), through check 50 and I'm getting rejections, if I will change the program according to the suggestions in the check50, the pyramids will be skewed. What am I missing?
include
include
int get_size(void);
void print_dots(int size);
void print_hash(int size);
int main(void)
{
int i = get_size(); //get size from user
for (int r = 1; r <= i; r++) // repeat printing
{
print_dots(r);
print_hash(r);
print_dots(6);
print_hash(r);
printf("\n");
}
}
int get_size(void) // function to get size >0 <=8
{
int i;
do
{
i = get_int("Height: "); // ask for positive integer
}
while (i < 1 || i > 8); // between 1 and 8
return i;
}
void print_dots(int size) //function to print spaces
{
for (int x = 8; x > size; x--)
{
printf(" ");
}
}
void print_hash(int size) //function to print hashes
{
for (int y = 0; y < size; y++)
{
printf("#");
}
}
:) mario.c exists
Log
checking that mario.c exists...
:) mario.c compiles
Log
running clang mario.c -o mario -std=c11 -ggdb -lm -lcs50...
:) rejects a height of -1
Log
running ./mario...
sending input -1...
checking that input was rejected...
:) rejects a height of 0
Log
running ./mario...
sending input 0...
checking that input was rejected...
:( handles a height of 1 correctly
Cause
expected ""# #"", not "" # # - here if I will remove spaces, it won't look as per instructions
Log
running ./mario...
sending input 1...
Expected Output: -same here
Actual Output:
:( handles a height of 2 correctly
Cause
expected "" # #"\n"## ...", not "" # #"..." -same here
Log
running ./mario...
sending input 2...
Expected Output: -same here
Actual Output:
## ##
:) handles a height of 8 correctly
Log
running ./mario...
sending input 8...
:( rejects a height of 9, and then accepts a height of 2 - what's wrong with this? It's meant to reject 9, and accept 2
Cause
expected "" # #"\n"## ...", not "" # #"..."
Log
running ./mario...
sending input 9...
checking that input was rejected...
sending input 2...
Expected Output:
Actual Output:
## ##
:) rejects a non-numeric height of "foo"
Log
running ./mario...
sending input foo...
checking that input was rejected...
:) rejects a non-numeric height of ""
Log
running ./mario...
sending input ...
checking that input was rejected...
Hi, I'm running mario-more (which behaves as expected), through check 50 and I'm getting rejections, if I will change the program according to the suggestions in the check50, the pyramids will be skewed. What am I missing?
include
include
int get_size(void); void print_dots(int size); void print_hash(int size);
int main(void) { int i = get_size(); //get size from user
} int get_size(void) // function to get size >0 <=8 { int i; do { i = get_int("Height: "); // ask for positive integer } while (i < 1 || i > 8); // between 1 and 8 return i; } void print_dots(int size) //function to print spaces { for (int x = 8; x > size; x--) { printf(" "); } } void print_hash(int size) //function to print hashes {
}
:) mario.c exists Log checking that mario.c exists... :) mario.c compiles Log running clang mario.c -o mario -std=c11 -ggdb -lm -lcs50... :) rejects a height of -1 Log running ./mario... sending input -1... checking that input was rejected... :) rejects a height of 0 Log running ./mario... sending input 0... checking that input was rejected... :( handles a height of 1 correctly Cause expected ""# #"", not "" # # - here if I will remove spaces, it won't look as per instructions Log running ./mario... sending input 1...
Expected Output: -same here
Actual Output:
:( handles a height of 2 correctly Cause expected "" # #"\n"## ...", not "" # #"..." -same here Log running ./mario... sending input 2...
Expected Output: -same here
Actual Output:
:) handles a height of 8 correctly Log running ./mario... sending input 8... :( rejects a height of 9, and then accepts a height of 2 - what's wrong with this? It's meant to reject 9, and accept 2 Cause expected "" # #"\n"## ...", not "" # #"..." Log running ./mario... sending input 9... checking that input was rejected... sending input 2...
Expected Output:
Actual Output:
:) rejects a non-numeric height of "foo" Log running ./mario... sending input foo... checking that input was rejected... :) rejects a non-numeric height of "" Log running ./mario... sending input ... checking that input was rejected...