2

First of all, welcome to CS50! :) To add to NullityNull's good advice, it looks to me like you probably have more than one copy of hello.c, probably in different directories. The one you are trying to compile is ~/workspace/hello.c. Do you have another copy of this file in the ~/workspace/pset1 directory? You can help us to see this by sharing the output of ...


2

First, make sure you are in the same directory that the program is in and you can check if so by typing 'ls' into the console. Another thing to do is make sure you named the file 'hello.c'. that little file extension is crucial in determining whether the IDE should use the C compiler on it. If you checked yes to any of those, then I don't know what to tell ...


2

Most of the problem is that no matter what you do, you keep putting the result back into change, a float. Floats have this nasty little problem that they don't store fractional parts of a number, the decimal part, correctly. In fact, your question demonstrates it well. If you store 0.01 in a float, it actually gets stored as 0....


2

Try printing out the value of cents after each calculation and think about the effect of integer division vs. regular division. Does the code track BOTH the number of coins for each denomination AND the change left over? Also, why is coins initialized to 1 and not 0?


1

You have set up the while condition incorrectly. Your do/while loop is this: do { ... } while (h>=1 || h<=8); You have essentially created an infinite loop. Think about the test condition. It has to be true for the loop to repeat and false for the loop to terminate. So, since you want it to be false to continue on past the loop, tell me one ...


1

Have a look at your gradebook. I would expect that you don't have grades for Resize, Recover (both pset3 this year), Homepage (pset5) and the final project. Is that what you are seeing? You will need to complete those.


1

Much shorter alternative: #include <stdio.h> int main(void) { int n = 6; char blocks[n]; memset(blocks,'#',n); for(int i=0; i<n; ++i) { printf("%*.*s %.*s\n", n, i+1, blocks, i+1, blocks ); } return 0; } Result Success #stdin #stdout 0s 9424KB # # ## ## ### ### #### #### ##### ##### ######...


1

:( handles a height of 1 correctly expected "# #\n", not " # #\n" The last row (or the first/only in this case) should be left aligned. As well, there should be 2 spaces between the half-pyramids. Can you see where yours is going wrong? You have space hash space hash instead of hash space space hash.


1

First of all, the problem with killed by the system is due to your program being stuck in an infinite loop. When I get into such an issue it helps me to take out a pen and paper and follow the variables through the program and see what happens. Its a form of debugging. You can also learn to use debug50. Specifically in your case think about what your ...


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