Back to track
#76 Easy Foundations

Hello, C++

Open the editor

Problem

Print exactly "Hello, C++" followed by a newline. Nothing is read from stdin — this is the smallest complete program the judge will accept.

Constraints

No input.

Input

None.

Output

One line: Hello, C++

The idea

Concept

Every C++ program enters at main(), and anything written to cout lands on stdout, which is exactly what the judge compares. Returning 0 signals success; the judge treats a non-zero exit as a runtime error even when the output looks right.

Approach

Stream the literal to cout, end with a newline, return 0.

Hints

  1. 1

    cout << "text" writes to stdout.

  2. 2

    The trailing newline matters — end the line with \n.

  3. 3

    main() must return an int; falling off the end implicitly returns 0.

Worked solution

Reference solution

Time: O(1) · Space: O(1)

One correct implementation. Any approach that satisfies the constraints is equally valid.

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cout << "Hello, C++" << '\n';
  return 0;
}

© 2026 ChitChat