C++ Beginner

Streams with cout, variables and your first loops.

3 lessons 7 tasks ⚡ Live compiler
Lessons Compiler Quiz Certificate

📚 Lessons

1 Streams & cout

C++ uses std::cout with the << operator for output and endl (or "\n") for newlines.

#include <iostream>
using namespace std;

int main() {
    cout << "Hello, C++!" << endl;
    cout << "2 + 2 = " << (2 + 2) << endl;
    return 0;
}

2 Variables & output

Declare typed variables and chain them into the stream. auto lets the compiler infer the type.

#include <iostream>
using namespace std;

int main() {
    int x = 9;
    double pi = 3.14159;
    cout << "x = " << x << ", pi = " << pi << endl;
    return 0;
}

3 Loops

Control flow mirrors C. Accumulate a result inside a for loop.

#include <iostream>
using namespace std;

int main() {
    int sum = 0;
    for (int i = 1; i <= 10; i++) sum += i;
    cout << "Sum 1..10 = " << sum << endl;
    return 0;
}

⚡ C++ Compiler

Code runs on a learning-oriented simulated runtime that supports common constructs (output, variables, arithmetic, conditionals and loops).

CPP

            

📝 Tasks

7 tasks across 3 pages — multiple-choice and fill-in (type the answer). Score 70% or higher to earn your certificate.

🎓 Certificate of Completion

🔒 Pass the quiz above (70%+) to unlock your downloadable certificate.