C++ Basics
Write and run a first program.
C++
#include <iostream>
using namespace std;
int main() {
cout << "Hello Programonic\n";
}Output
Hello Programonic
Explanation
A C++ program begins in main. Include iostream to write to standard output with cout. The line using namespace std; lets you write cout instead of std::cout.
Explore the dry run
Guided walkthroughReady
1
#include <iostream>2
using namespace std;3
4
int main() {5
cout << "Hello Programonic\n";6
}Follow the example
Start to inspect the source, values, and output. These prepared steps explain the published sample; grouped loop steps describe multiple iterations.
View the complete dry-run table
| Step / line | What happens | State after step | Output so far |
|---|---|---|---|
| Program execution enters main. | — | — | |
| Write the string and newline to standard output. | — | Hello Programonic |