Skip to main content
4 votes
Accepted

Stuck on PSet1: I have the correct output, but Check50 output says it's wrong

edited question From the spec: Take care to left-align the bottom-left corner of the left-hand half-pyramid with the left-hand edge of your terminal window. In other words, the last line must ...
DinoCoderSaurus's user avatar
2 votes

Hacker edition problems

The hacker edition problems have now become the "more comfortable" problems in a problem set. For example, in pset1, mario (less comfortable) involves printing one pyramid, while mario (more ...
Jason_V's user avatar
  • 182
1 vote

Always having the same randomized game of fifteen

In the GNU C library, RAND_MAX, the default maximum return value of rand() is the largest signed integer value. And so, sometimes, if the rand() returns a high enough value and you multiply it by "i", ...
Sándor Matlák's user avatar
1 vote
Accepted

Always having the same randomized game of fifteen

Like most soi-disant "random" functions, rand() isn't really random. It generates pseudorandom numbers using a deterministic algorithm. This algorithm will always produce the same results if it is "...
hotwebmatter's user avatar
  • 3,050
1 vote

Issue when randomizing tiles of the game of fifteen with Fisher-Yates algorithm

The problem lies here: int j = rand() * i; The call to rand() returns a very large number. From there on, it just gets propogated through the code, used in other calculations, and pushed further ...
Cliff B's user avatar
  • 68.8k
1 vote

"Bad Credit" segmentation fault issue

I'd suggest a different method of turning your long long into an array: (1) Declare a char array with char s[20]; (20 digits should be enough for a long long), (2) Use sprintf to pass num into char ...
Alex Ashman's user avatar
1 vote
Accepted

pset2 hacker - initials.c outputs "MB" for " milo banana " expected output, but not "MB\u0000\n"

Interesting. I ran your code and it passed check50. I was unable to duplicate the problem. However, I do see the issue. You were on the right track, but your attempts to correct had errors. The ...
Cliff B's user avatar
  • 68.8k
1 vote

What is wrong with my hacker mario.c code for pset1?

I would pick small numbers for h (e.g., 1 and 2), determine what the expected results should look like and follow the logic of my code using a pencil and a paper. for example, when h == 1, I should ...
kzidane's user avatar
  • 17.7k

Only top scored, non community-wiki answers of a minimum length are eligible