# Problem Set 1: C

## tl;dr

1. Watch Week 1’s lecture.

2. Get your CS50 IDE set up with `hello.c`.

3. Calculate your water consumption with `water.c`.

4. Recreate one of Mario’s pyramids, in `mario.c`.

5. Provide a user with either cash or credit in `greedy.c` or `credit.c`.

7. Submit a form.

## Help

For help with Week 1 and Problem Set 1:

• Attend David’s walkthrough on Wed 9/7, 1pm – 2:30pm, in Sanders.

• Watch Zamyla’s walkthroughs herein.

• Attend one of Week 1’s course-wide sections (aka supersections):

• Wed 9/7, 2:30pm – 4pm, in Emerson 210 for those less comfortable (and somewhere in between)

• Wed 9/7, 4:30pm – 6pm, in Emerson 2010 for those more comfortable (and somewhere in between)

• Post questions and search answers in CS50 Discuss.

• Attend office hours.

## Getting Started

Recall that CS50 IDE is a web-based "integrated development environment" that allows you to program "in the cloud," without installing any software locally. Underneath the hood is a popular operating system, Ubuntu Linux, that’s been "containerized" with open-source software called Docker, that allows multiple users (like you!) to share the operating system’s "kernel" (its nucleus, so to speak) and files, even while having files of their own. Indeed, CS50 IDE provides you with your very own "workspace" (i.e., storage space) in which you can save your own files and folders (aka directories).

### Logging In

You should then be informed that CS50 IDE (aka Cloud9, the software that underlies CS50 IDE) is "creating your workspace" and "creating your container," which might take a moment. You should eventually see your workspace, which should resemble mine from Week 1. If not, do just email the course’s heads to inquire!

### Updating

Toward the bottom of CS50 IDE’s UI is a "terminal window" (light blue, by default), a command-line interface (CLI) that allows you to explore your workspace’s files and directories, compile code, run programs, and even install new software. You should find that its "prompt" resembles the below.

``~/workspace/ $`` Click inside of that terminal window and then type ``update50`` followed by Enter to ensure that your workspace is up-to-date. It might take a few minutes for any updates to complete. (Be sure not to close the tab or CS50 IDE itself until they do!) Next, execute ``mkdir ~/workspace/pset1/`` at your prompt in order to make a directory called `pset1` in your `workspace` directory. Take care not to overlook the space between `mkdir` and `~/workspace/pset1` or any other character for that matter! Keep in mind that `~` denotes your home directory, `~/workspace` denotes a directory called `workspace` therein, and `~/workspace/pset1` denotes a directory called `pset1` within `~/workspace`. Now execute ``cd ~/workspace/pset1/`` to move yourself into (i.e., open) that directory. Your prompt should now resemble the below. ``~/workspace/pset1/$``

If not, retrace your steps and see if you can determine where you went wrong. You can actually execute

``history``

at the prompt to see your last several commands in chronological order if you’d like to do some sleuthing. You can also scroll through the same one line at a time by hitting your keyboard’s up and down arrows; hit Enter to re-execute any command that you’d like.

## What to Do

1. Implement Hello

2. Implement Water

3. Implement either of:

4. Implement either of:

## How to Submit

### Step 1 of 2

2. Toward CS50 IDE’s top-left corner, within its "file browser" (not within a terminal window), control-click or right-click your `hello.c` file (that’s within your pset1 directory) and then select Download. You should find that your browser has downloaded `hello.c`.

3. Repeat for `water.c`.

4. Repeat for `mario.c`.

5. Repeat for `greedy.c` or `credit.c`.

6. In a separate tab or window, log into CS50 Submit, logging in if prompted.

7. Click Submit toward the window’s top-left corner.

8. Under Problem Set 1 on the screen that appears, click Upload New Submission.

9. On the screen that appears, click Add files…​. A window entitled Open Files should appear.

10. Navigate your way to `hello.c`. Odds are it’s in your Downloads folder or wherever your browser downloads files by default. Once you find `hello.c`, click it once to select it, then click Open (or the like).

11. Click Add files…​ again, and a window entitled Open Files should appear again.

12. Navigate your way to `water.c` as before. Click it once to select it, then click Open (or the like).

13. Navigate your way to `mario.c` as before. Click it once to select it, then click Open (or the like).

14. Navigate your way to `greedy.c` or `credit.c` as before. Click it once to select it, then click Open (or the like).