🧰 Setting Up C++ on Your Computer
Before we start building awesome C++ programs, we need to set up your coding environment. Don’t worry — it’s easier than cooking instant noodles 🍜!
💻 1. Install a C++ Compiler
You need a compiler that translates your C++ code into something the computer understands (like a translator for computers!).
- 🪟 Windows: Install Code::Blocks with MinGW — includes both editor + compiler
- 🍎 macOS: Open Terminal and run:
xcode-select --install
- 🐧 Linux (Debian/Ubuntu): Open Terminal and run:
sudo apt install g++
📝 2. Choose a Code Editor
You can write C++ code in Notepad (yikes! 😅), but here are better options:
- Code::Blocks – All-in-one IDE for beginners
- Visual Studio – Great for Windows users
- VS Code – Lightweight and customizable (you’ll need to install extensions for C++)
🚀 3. Write & Run Your First C++ Code
Let’s test your setup by writing a classic Hello, World! program:
#include <iostream> using namespace std; int main() { cout << "Hello, C++ World!" << endl; return 0; }
✅ Output:
Hello, C++ World!
🛠️ How to Compile and Run (Command Line Method)
If you’re using the command line (you’re hardcore 😎), here’s how:
g++ hello.cpp -o hello ./hello
🎉 You’re All Set!
You’ve successfully installed a C++ compiler and run your first program. Now you’re ready to dive into real C++ coding adventures! 🧠💻