Hello, It’s Me
Problem to Solve
In a file called hello.c
, in a folder called me
, implement a program in C that prompts the user for their name and then says hello to that user. For instance, if the user’s name is Adele, your program should print hello, Adele\n
!
Hints
- Recall that you can get a
string
from a user withget_string
, which is declared incs50.h
. - Recall that you can print a
string
withprintf
, which is declared instdio.h
. - Recall that you can format a
string
withprintf
with%s
.
Demo
How to Begin
Execute cd
by itself in your terminal window. You should find that your terminal window’s prompt resembles the below:
$
Next execute
mkdir me
to make a folder called me
in your codespace.
Then execute
cd me
to change directories into that folder. You should now see your terminal prompt as me/ $
. You can now execute
code hello.c
to create a file called hello.c
in which you can write your code.
Walkthrough
Here’s a “walkthrough” (i.e., tour) of this problem, if you’d like a verbal overview of what to do too!
How to Test
Correctness
check50 cs50/problems/2024/spring/me
Style
style50 hello.c
How to Submit
After you submit, be sure to check your autograder results. If you see SUBMISSION ERROR: missing files (0.0/1.0)
, it means your file was not named exactly as prescribed (or you uploaded it to the wrong problem).
Correctness in submissions entails everything from reading the specification, writing code that is compliant with it, and submitting files with the correct name. If you see this error, you should resubmit right away, making sure your submission is fully compliant with the specification. The staff will not adjust your filenames for you after the fact!
- Download your
hello.c
file by control-clicking or right-clicking on the file in your codespace’s file browser and choosing Download. - Go to CS50’s Gradescope page.
- Click Problem Set 1: Hello, It’s Me.
- Drag and drop your
hello.c
file to the area that says Drag & Drop. Be sure it has that exact filename! If you upload a file with a different name, the autograder likely will fail when trying to run it. Ensuring you have uploaded files with the correct filename is your responsibility! - Click Upload.
You should see “Problem Set 1: Hello, It’s Me submitted successfully!”