0

Just started cs50 on edx a week ago. Just finishing the walkthroughs for Week 1. In the walkthroughs, there is a one video about "Switch" and "Cases". Ive written the code correctly, I think, but everytime I try to compile it, it just says RETRY. I have saved it in the desktop in jharvard. I have no clue what to do at this point.

enter image description here

1

Say you have written a program named example.c

First you compile your program like so

make example

Then you run it like so

./example

I tell you these because I see you have tried many times to do them in your terminal.

If you want to terminate a program, before it does itself, you press Ctrl+C.

In your case, you compiled adder2.c using make adder2. When it says

make: `adder2' is up to date.

it means that you haven't changed anything in your code since you last compiled it, so there is nothing to be made again.

Then you run it by ./adder2. Your program starts and prompts:

Please choose a number between 0 and 10!

and then it expects you to give it an int like 5.

But instead, you give it string, which in your case is make adder2. The function GetInt() "sees" that you didn't give an integer, and it prompts you to retry by:

Retry:

If you are still on the same spot, either give an int and let the program finish, or press Ctrl+C and run it again.

Starter tip If you want to clear your terminal from all outputs to start anew, type

clear

or press Ctrl+L

They won't be lost, just moved one screen upper. If you want to clear the completely type

reset

If this answers your question please accept it by clicking the gray check-mark to the left, so that it becomes green. You can also vote it up by pressing the up arrow above the check-mark. And don't forget to keep coding!

| improve this answer | |

You must log in to answer this question.

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