ā¹ļø Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://onecompiler.com/cpp |
| Last Crawled | 2026-04-17 01:29:33 (3 hours ago) |
| First Indexed | 2019-04-16 22:20:57 (7 years ago) |
| HTTP Status Code | 200 |
| Meta Title | C++ Online Compiler |
| Meta Description | OneCompiler's CPP online editor helps you to write, compile, debug and run C++ code online. It's powered by GCC compiler |
| Meta Canonical | null |
| Boilerpipe Text | Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. It's one of the robust, feature-rich online compilers for C++ language, running on GCC 13 with C++17 support. Getting started with the OneCompiler's C++ compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as
C++
and start coding!
Read inputs from stdin
OneCompiler's C++ online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.
#
include
<iostream>
#
include
<string>
using
namespace
std
;
int
main
()
{
string
name;
cout
<<
"Enter name:"
;
getline (
cin
, name);
cout
<<
"Hello "
<< name;
return
0
;
}
About C++
C++ is a widely used middle-level programming language.
Supports different platforms like Windows, various Linux flavours, MacOS etc
C++ supports OOPS concepts like Inheritance, Polymorphism, Encapsulation and Abstraction.
Case-sensitive
C++ is a compiler based language
C++ supports structured programming language
C++ provides alot of inbuilt functions and also supports dynamic memory allocation.
Like C, C++ also allows you to play with memory using Pointers.
Syntax help
Loops
1. If-Else:
When ever you want to perform a set of operations based on a condition If-Else is used.
if
(conditional-expression) {
//code
}
else
{
//code
}
You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.
2. Switch:
Switch is an alternative to If-Else-If ladder.
switch
(conditional-expression){
case
value1:
// code
break
;
// optional
case
value2:
// code
break
;
// optional
......
default
:
code to be executed when all the above cases are
not
matched;
}
3. For:
For loop is used to iterate a set of statements based on a condition.
for
(Initialization; Condition; Increment/decrement){
//code
}
4. While:
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while
(condition) {
// code
}
5. Do-While:
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do
{
// code
}
while
(condition);
Functions
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity. Function gets run only when it is called.
How to declare a Function:
return_type
function_name
(parameters)
;
How to call a Function:
function_name (parameters)
How to define a Function:
return_type
function_name
(parameters)
{
// code
} |
| Markdown | [](https://onecompiler.com/)
[Pricing](https://onecompiler.com/pricing)
Learn
Code
Deploy
More
Login
Main.cpp
# C++ Hello World
AI
CPP
RUN
AI
CPP
RUN
Main.cpp
1
2
3
4
5
6
7
8
\#include \<iostream\>
using namespace std;
int main()
{
cout \<\< "Hello, World\!";
return 0;
}
××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
STDIN
Output:
```
Click on RUN button to see the output
```
# C++ Online Compiler
Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. It's one of the robust, feature-rich online compilers for C++ language, running on GCC 13 with C++17 support. Getting started with the OneCompiler's C++ compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as `C++` and start coding\!
# Read inputs from stdin
OneCompiler's C++ online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.
```
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "Enter name:";
getline (cin, name);
cout << "Hello " << name;
return 0;
}
```
# About C++
C++ is a widely used middle-level programming language.
- Supports different platforms like Windows, various Linux flavours, MacOS etc
- C++ supports OOPS concepts like Inheritance, Polymorphism, Encapsulation and Abstraction.
- Case-sensitive
- C++ is a compiler based language
- C++ supports structured programming language
- C++ provides alot of inbuilt functions and also supports dynamic memory allocation.
- Like C, C++ also allows you to play with memory using Pointers.
# Syntax help
## Loops
### 1\. If-Else:
When ever you want to perform a set of operations based on a condition If-Else is used.
```
if(conditional-expression) {
//code
}
else {
//code
}
```
You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.
### 2\. Switch:
Switch is an alternative to If-Else-If ladder.
```
switch(conditional-expression){
case value1:
// code
break; // optional
case value2:
// code
break; // optional
......
default:
code to be executed when all the above cases are not matched;
}
```
### 3\. For:
For loop is used to iterate a set of statements based on a condition.
```
for(Initialization; Condition; Increment/decrement){
//code
}
```
### 4\. While:
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
```
while (condition) {
// code
}
```
### 5\. Do-While:
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
```
do {
// code
} while (condition);
```
## Functions
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity. Function gets run only when it is called.
### How to declare a Function:
```
return_type function_name(parameters);
```
### How to call a Function:
```
function_name (parameters)
```
### How to define a Function:
```
return_type function_name(parameters) {
// code
}
```
###### OneCompiler.com
[About](https://onecompiler.com/about)[Use Cases](https://onecompiler.com/customer-use-cases)[Contact](https://onecompiler.com/contact)
[Users](https://onecompiler.com/users)[Status](https://status.onecompiler.com/)[Pricing](https://onecompiler.com/pricing)[Refund Policy](https://onecompiler.com/about#refund-policy)
[GitHub](https://github.com/onecompiler)[LinkedIn](https://www.linkedin.com/company/onecompiler)[Facebook](https://www.facebook.com/onecompiler)[Instagram](https://www.instagram.com/onecompiler)[Twitter](https://twitter.com/OneCompilerHQ)
###### Languages
[Python](https://onecompiler.com/python)[Java](https://onecompiler.com/java)[C](https://onecompiler.com/c)[C++](https://onecompiler.com/cpp)[JavaScript](https://onecompiler.com/javascript)[Lua](https://onecompiler.com/lua)[PHP](https://onecompiler.com/php)[NodeJS](https://onecompiler.com/nodejs)[C\#](https://onecompiler.com/csharp)[Assembly](https://onecompiler.com/assembly)[Bash](https://onecompiler.com/bash)[Visual Basic (VB.NET)](https://onecompiler.com/vb)[Kotlin](https://onecompiler.com/kotlin)[Pascal](https://onecompiler.com/pascal)[Ruby](https://onecompiler.com/ruby)[Groovy](https://onecompiler.com/groovy)[Scala](https://onecompiler.com/scala)[Prolog](https://onecompiler.com/prolog)[Tcl](https://onecompiler.com/tcl)[TypeScript](https://onecompiler.com/typescript)[JShell](https://onecompiler.com/jshell)[Haskell](https://onecompiler.com/haskell)[Ada](https://onecompiler.com/ada)[CommonLisp](https://onecompiler.com/commonlisp)[D](https://onecompiler.com/d)[Elixir](https://onecompiler.com/elixir)[Erlang](https://onecompiler.com/erlang)[F\#](https://onecompiler.com/fsharp)[Fortran](https://onecompiler.com/fortran)[Python2](https://onecompiler.com/python2)[Perl](https://onecompiler.com/perl)[Go](https://onecompiler.com/go)[R](https://onecompiler.com/r)[Racket](https://onecompiler.com/racket)[OCaml](https://onecompiler.com/ocaml)[Basic](https://onecompiler.com/basic)[HTML](https://onecompiler.com/html)[React](https://onecompiler.com/react)[Vue](https://onecompiler.com/vue)[Angular](https://onecompiler.com/angular)[Materialize](https://onecompiler.com/materialize)[Bootstrap](https://onecompiler.com/bootstrap)[Tailwind CSS](https://onecompiler.com/tailwindcss)[HTMX](https://onecompiler.com/htmx)[Alpine.js](https://onecompiler.com/alpinejs)[Chart.js](https://onecompiler.com/chartjs)[D3.js](https://onecompiler.com/d3js)[JQuery](https://onecompiler.com/jquery)[Foundation](https://onecompiler.com/foundation)[Bulma](https://onecompiler.com/bulma)[Uikit](https://onecompiler.com/uikit)[Semantic UI](https://onecompiler.com/semanticUI)[Skeleton](https://onecompiler.com/skeleton)[Milligram](https://onecompiler.com/milligram)[PaperCSS](https://onecompiler.com/paperCss)[BackboneJS](https://onecompiler.com/backbonejs)[sh (Shell Script)](https://onecompiler.com/sh)[Clojure](https://onecompiler.com/clojure)[Cobol](https://onecompiler.com/cobol)[Rust](https://onecompiler.com/rust)[Swift](https://onecompiler.com/swift)[Objective-C](https://onecompiler.com/objectivec)[Octave](https://onecompiler.com/octave)[Text](https://onecompiler.com/text)[BrainFK](https://onecompiler.com/brainfk)[CoffeeScript](https://onecompiler.com/coffeescript)[EJS](https://onecompiler.com/ejs)[Dart](https://onecompiler.com/dart)[Deno](https://onecompiler.com/deno)[Bun](https://onecompiler.com/bun)[Crystal](https://onecompiler.com/crystal)[Julia](https://onecompiler.com/julia)[Zig](https://onecompiler.com/zig)[AWK](https://onecompiler.com/awk)[ISPC](https://onecompiler.com/ispc)[Smalltalk](https://onecompiler.com/smalltalk)[Nim](https://onecompiler.com/nim)[Scheme](https://onecompiler.com/scheme)[J](https://onecompiler.com/j)[V](https://onecompiler.com/v)[Raku](https://onecompiler.com/raku)[Verilog](https://onecompiler.com/verilog)[Haxe](https://onecompiler.com/haxe)[Forth](https://onecompiler.com/forth)[Icon](https://onecompiler.com/icon)[Odin](https://onecompiler.com/odin)[MySQL](https://onecompiler.com/mysql)[Oracle Database](https://onecompiler.com/oracle)[PostgreSQL](https://onecompiler.com/postgresql)[MongoDB](https://onecompiler.com/mongodb)[SQLite](https://onecompiler.com/sqlite)[Redis](https://onecompiler.com/redis)[MariaDB](https://onecompiler.com/mariadb)[Oracle PL/SQL](https://onecompiler.com/plsql)[Microsoft SQL Server](https://onecompiler.com/sqlserver)[Cassandra](https://onecompiler.com/cassandra)[QuestDB](https://onecompiler.com/questdb)[DuckDB](https://onecompiler.com/duckdb)[SurrealDB](https://onecompiler.com/surrealdb)[Firebird](https://onecompiler.com/firebird)[ClickHouse](https://onecompiler.com/clickhouse)
###### More
[Studio](https://onecompiler.com/studio)[Orgs](https://onecompiler.com/orgs)[API](https://onecompiler.com/apis)[Pricing](https://onecompiler.com/apis/pricing)
[Cheatsheets](https://onecompiler.com/cheatsheets)[Tutorials](https://onecompiler.com/tutorials)[Tools](https://onecompiler.com/tools)[AI Tools](https://onecompiler.com/ai)[Stats](https://onecompiler.com/stats)
Ā© Copyright 2026 One Compiler Pvt. Ltd. \| [Privacy Policy](https://onecompiler.com/privacy-policy) \| [Terms & Conditions](https://onecompiler.com/terms-and-conditions) |
| Readable Markdown | Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. It's one of the robust, feature-rich online compilers for C++ language, running on GCC 13 with C++17 support. Getting started with the OneCompiler's C++ compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as `C++` and start coding\!
## Read inputs from stdin
OneCompiler's C++ online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.
```
#include <iostream>
#include <string>
using namespace std;
int main()
{
string name;
cout << "Enter name:";
getline (cin, name);
cout << "Hello " << name;
return 0;
}
```
## About C++
C++ is a widely used middle-level programming language.
- Supports different platforms like Windows, various Linux flavours, MacOS etc
- C++ supports OOPS concepts like Inheritance, Polymorphism, Encapsulation and Abstraction.
- Case-sensitive
- C++ is a compiler based language
- C++ supports structured programming language
- C++ provides alot of inbuilt functions and also supports dynamic memory allocation.
- Like C, C++ also allows you to play with memory using Pointers.
## Syntax help
## Loops
### 1\. If-Else:
When ever you want to perform a set of operations based on a condition If-Else is used.
```
if(conditional-expression) {
//code
}
else {
//code
}
```
You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.
### 2\. Switch:
Switch is an alternative to If-Else-If ladder.
```
switch(conditional-expression){
case value1:
// code
break; // optional
case value2:
// code
break; // optional
......
default:
code to be executed when all the above cases are not matched;
}
```
### 3\. For:
For loop is used to iterate a set of statements based on a condition.
```
for(Initialization; Condition; Increment/decrement){
//code
}
```
### 4\. While:
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
```
while (condition) {
// code
}
```
### 5\. Do-While:
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
```
do {
// code
} while (condition);
```
## Functions
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity. Function gets run only when it is called.
### How to declare a Function:
```
return_type function_name(parameters);
```
### How to call a Function:
```
function_name (parameters)
```
### How to define a Function:
```
return_type function_name(parameters) {
// code
}
``` |
| Shard | 139 (laksa) |
| Root Hash | 1017704921348289539 |
| Unparsed URL | com,onecompiler!/cpp s443 |