Learn C++ online: interactive lessons
cout, cin, strings, vectors, loops, functions and structs with modern C++20. Free, no sign-up: your progress is saved in this browser.
Lesson 1 · C++
Hello, C++
std::cout << writes to the output and std::endl ends the line. using namespace std; lets you write cout instead of std::cout.
Your task: Print Hello, C++! on one line.
#include <iostream>
using namespace std;
int main() {
cout << "Hello" << endl;
return 0;
}
Your output
Expected output
Hello, C++!