Hello, World
A main function, #include <iostream> and std::cout.
Runs in Zerethon IDE · C++ (GCC 14)
Official C++ documentation ↗
main.cpp
#include <iostream>
int main() {
std::cout << "Hello, World!\n";
std::cout << "Sum: " << 2 + 3 << '\n';
return 0;
}
Output
Hello, World! Sum: 5
<<sends values to the stream one after another;\nends the line (std::endlalso flushes, which is slower).- Standard names live in the
stdnamespace:std::cout,std::string,std::vector. return 0;frommainmeans success (it may be left out inmainonly).