Skip to content

Commit 5614d6f

Browse files
committed
hello
1 parent 9f070fc commit 5614d6f

File tree

3 files changed

+25
-35
lines changed

3 files changed

+25
-35
lines changed

hello/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Makefile for CS50-type assignments
2+
3+
%: %.c
4+
clang -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -o $@ $< -lcs50 -lcrypt -lm

hello/index.md

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,52 +14,31 @@ Here's your first C program:
1414
You have seen it in lecture, and now you're ready to try running it yourself.
1515

1616

17-
## Getting your own IDE
17+
## Dive into your development environment
1818

19-
The CS50 IDE is an online environment in which you can write code, compile your programs and debug those using built-in tools. Use the following steps to request your personal IDE account.
19+
Go to your Terminal. You should find that its "prompt" resembles the below.
2020

21-
- Create an account on [GitHub](https://github.com/join). This website is used by software developers around the world to collaborate. In later courses, you might use the website directly to put your own programs on! However, for this course, we just use GitHub's login mechanism to allow you access to a few other websites created by Harvard's CS50 team.
21+
jharvard@somewhere ~ %
2222

23-
- Head to [ide.cs50.io](https://ide.cs50.io/) and log into CS50 IDE using the GitHub account that you created. If all is well, 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. If not, take it up with the support staff right away!
23+
Click inside of that terminal window and then type (on Mac OS):
2424

25+
mkdir ~/Documents/problems
2526

26-
## Dive into the IDE
27-
28-
Head to [ide.cs50.io](https://ide.cs50.io/) and click "Sign in with GitHub" to access. Once your IDE loads, you should see that (by default) it's divided into three parts. Toward the top of CS50 IDE is your "text editor", where you'll write all of your programs. Toward the bottom of 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. And on the left is your "file browser", which shows you all of the files and folders currently in your IDE.
29-
30-
Start by clicking inside your terminal window. You should find that its "prompt" resembles the below.
31-
32-
~/ $
33-
34-
Click inside of that terminal window and then type
35-
36-
mkdir ~/problems
37-
38-
followed by Enter in order to make a directory (i.e., folder) called `problems` inside of your home directory. You should see in the file list on the left that your first folder has been created. We call it `problems` so it can contain all programs that you write for the course.
27+
followed by Enter in order to make a directory (i.e., folder) called `problems` inside of your Documents directory.
3928

4029
Here on out, to execute (i.e., run) a command means to type it into a terminal window and then hit Enter. Commands are "case-sensitive," so be sure not to type in uppercase when you mean lowercase or vice versa.
4130

4231
Now execute
4332

44-
cd ~/problems/
33+
cd ~/Documents/problems/
4534

4635
to move yourself into (i.e., open) that directory. Your prompt should now resemble the below.
4736

48-
~/problems/ $
37+
problems %
4938

5039
If not, retrace your steps and see if you can determine where you went wrong.
5140

52-
Now execute
53-
54-
mkdir ~/problems/hello
55-
56-
to create a new directory called `hello` inside of your `problems` directory. Then execute
57-
58-
cd ~/problems/hello
59-
60-
to move yourself into that directory.
61-
62-
Now, point to the File menu and choose New. This will open a new editor with a blank "Untitled1" file in it. First thing to do is to give it a name and save it into your new directory. Press **CTRL-S** or **Cmd-S** to open the file dialog. For **Filename**, type `hello.c`. Then below, choose (click) the `problems` and then `hello` folder that you just created and click on **Save**.
41+
Now, open Atom, point to the File menu and choose New. This will open a new editor with a blank "Untitled1" file in it. First thing to do is to give it a name and save it into your new directory. Press **CTRL-S** or **Cmd-S** to open the file dialog. For **Filename**, type `hello.c`. Then below, choose (click) the `Documents`, then the `problems` folder that you just created and click on **Save**.
6342

6443
In your new file, type the C code for "Hello, World" as seen above. Save it once more.
6544

@@ -111,7 +90,18 @@ Hello there again!
11190

11291
## Making things easier
11392

114-
Recall that we can automate the process of executing `clang`, letting `make` figure out how to do so for us, thereby saving us some keystrokes. Execute the below to compile this program one last time.
93+
Recall from lecture that we can automate the process of executing `clang`, letting `make` figure out how to do so for us, thereby saving us some keystrokes.
94+
95+
Create a new file called `Makefile` (no dot! no extension) and enter into it the following lines:
96+
97+
# Makefile for CS50-type assignments
98+
99+
%: %.c
100+
clang -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow -o $@ $< -lcs50 -lcrypt -lm
101+
102+
Make sure that right before "clang" in that last line is a TAB character and not 4 spaces. Save the file.
103+
104+
Now execute the below to compile your program one last time.
115105

116106
make hello
117107

mario/less/index.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,6 @@ Execute the below to evaluate the correctness of your code using `check50`. But
205205

206206
check50 -l minprog/cs50x/2020/mario/less
207207

208-
Execute the below to evaluate the style of your code using `style50`.
209-
210-
style50 mario.c
211-
212208
### Hint
213209

214210
A space is just a press of your space bar, just as a period is just a press of its key! Just remember that `printf` requires that you surround both with double quotes!

0 commit comments

Comments
 (0)