Small Steps I — Creating with Text and Numbers

Showing text on the screen

Print your own name instead of "Hello!".

What you will learn

A program tells a computer what to do. The written instructions are code; asking the computer to carry them out is running the program. Today we will display a greeting.

Try it

Example · example.cpp
void small_main()
{
    print("Hello!");
}

Open the code with Try This Code, then press Run or F5. The text appears in a console window.

A string is a value made of characters in order. The double quotes in "Hello!" mark its beginning and end. A function groups instructions under a name. print is a function that produces output; print("Hello!"); passes it a greeting and calls it.

small_main is the function where we write our instructions. For now, keep the surrounding structure and change only print inside { }. Keep the ; at the end of the statement too.

Expected output:

Hello!

Exercise

Print your own name instead of "Hello!".

Exercise starter · exercise_starter.cpp
void small_main()
{
    print("Hello!");
}

Hint

Change only the text inside the double quotes. print starts with a lowercase p.

show solution
void small_main()
{
    print("Alex");
}
Next lesson →