CodeCompiler
F
main.cpp
>_
Live Console
Click Run to start

C++ Online Compiler

Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. C++ is a general purpose, object-oriented programming language created by Bjarne Stroustrup as an extension of C.

About C++

C++ is widely used in competitive programming, game engines, system software, and high-performance applications.

Key features

  • Free
  • Online
  • Real-time output
  • Easy & fast
  • No setup or installation required

Hello World

#include <iostream>
using namespace std;
int main() {
    cout << "Hello, World!" << endl;
    return 0;
}

Classes

class Person {
public:
    string name;
    Person(string n) : name(n) {}
    void greet() { cout << "Hi, " << name; }
};