Skip to content

Theory, a question and code — theme by theme

Courses with C++, Python, Go, JavaScript, Java, C#, PHP, SQL, Rust, 1C and Docker/Kubernetes exercises: read the theory, answer a question and write code that tests check right in the browser.

Free lessons are readable without an account; running code and saving progress need sign-in. No card needed.

Theory

switch and fall-through

switch evaluates the expression once and jumps to the case label with the same value; break ends the switch.

Question

n = 2, and case 2 and case 3 have no break. What does the program print?

  • Ab
  • Bbc
  • Cbcd your answer, correct
  • DIt does not compile
Code

Exercise: leap year

bool is_leap(int year) {
    return false;
}
Run tests
C++ for Beginnerstheme 4 of 18 · lesson 5 of 6

Three steps

  1. Open “C++ for Beginners”

    Free end to end: 18 themes, 163 lessons, 37 of them coding exercises.

  2. Theory → question → code

    A walkthrough, a question to check you got it, an exercise that tests check. No compiler to install.

  3. Pick up where you left off

    Progress lives in your account: close the tab and come back to the same lesson from another device.

What people ask

What is free?
“C++ for Beginners” is open end to end. In paid courses the first lessons are free and the subscription opens the rest.
Which languages are the exercises in?
C++, Python, Go, JavaScript, Java, C#, PHP, SQL, Rust, 1C and Docker/Kubernetes. Tests check your code right in the browser.
Which courses are there?
“C++ for Beginners”, “Machine Learning from Scratch”, “Go for Beginners”, “Python Core”, “JavaScript for Beginners”, “TypeScript for Beginners”, “Java Core”, “C# for Beginners”, “Swift for Beginners”, “PHP for Beginners”, “Rust for Beginners”, “SQL Core”, “Docker and Kubernetes”, “Databases in Depth”, “Message Brokers: Kafka, RabbitMQ, NATS” and “System Design Interview Prep”. All of them are in the course catalogue.

Start with “C++ for Beginners”