0

In the terminal window the current directory is always shown on the line where a command can be typed in. While working on pset1/mario/less somehow I have created the issue by which the current directory is not shown, thus no commands work. As you can see from the screenshot, the issue occurred when I ran the program which asked for an positive integer under 23. During testing, I tried the integer 46 and the program did nothing. I went in and changed the code to try to correct the bug. After saving I pressed the "Enter" key to get on a new line, and then tried to recompile the program. Nothing happened. I have also tried the following things to fix this problem:

cd.

cd

manually typing the directory into the terminal window

manually typing the directory and a command into the terminal window

help50 make mario3

the number 5, which if the program was running would have been an acceptable response

copying mario3

exiting and re-opening Cloud9

logging into Cloud9 through Chrome (Problem occurred in Firefox)

Thank you in advance for any help!!![Screenshot]1

0

Looks like the commands did not go to the shell, but to your programme still running, maybe waiting for you to input a number. If you want to end your programme but it won't end on the regular way (for example because you created an infinite loop), you can use Ctrl+C to send an interrupt signal (SIGINT), usually ending the programme (a "friendly" way similar to SIGTERM, while SIGKILL gives no way to clean up). If you are already on the shell, this wouldn't terminate the shell.

Also, the code shown does not match the running programme, as this code would have acted differently.

In your code, you have two loops, both requesting at least one input, the first requiring it to be positive (should be non-negative instead, 0 per problem description is a valid input value!), second requiring another number less than or equal 23. Instead, you need a single loop requiring the number to fulfill both criteria at the same time. Look up boolean/logical operators (both names mean the same, as George Boole was much into logic).

| improve this answer | |
  • Ctrl + c worked! Thank you very much for the tip about boolean operators, that was just what I needed to move forward and make the code more clean. – Robin Jan 16 '19 at 19:34
0

Can you try from the menu CS50IDE > Restart? Alternatively, close the terminal tab itself (click the x) and then open a new one.

| improve this answer | |

You must log in to answer this question.

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