KEMBAR78
C++ Lab Sheet 1 | PDF | C++ | Command Line Interface
0% found this document useful (0 votes)
6 views3 pages

C++ Lab Sheet 1

This document provides a comprehensive guide for installing and using Code::Blocks for C++ programming. It outlines the installation steps, how to set up the environment, and details on creating and running a C++ project. Additionally, it includes a simple code example and a summary table of the main steps involved in the process.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

C++ Lab Sheet 1

This document provides a comprehensive guide for installing and using Code::Blocks for C++ programming. It outlines the installation steps, how to set up the environment, and details on creating and running a C++ project. Additionally, it includes a simple code example and a summary table of the main steps involved in the process.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

7th, KM Haridwar, National Highway Vardhmanpuram,

Roorkee, Rehmadpur, Uttarakhand 247667

Lab Sheet-01
Getting Started with Code::Blocks: Installation,
Overview, and Writing Your First C++ Program
BCA I Semester (Session 2025-2026)

Steps to Install Code::Blocks


1. Download the Installer
• Visit the official Code::Blocks website and go to the “Downloads” section.
• Choose “Download the binary release” and select your operating system (e.g.,
Windows 10/11).
• Download the installer named something like codeblocks-20.03mingw-
setup.exe (recommended, as it includes the GCC compiler).
2. Run the Installer
• Locate the downloaded file in your Downloads folder.
• Double-click the file and allow any permissions that are requested.
3. Set Installation Options
• Click Next through the initial dialogs.
• Agree to the license agreement.
• Leave the default install location selected unless you have a specific preference
(usually C:\Program Files\CodeBlocks).
• Click Install.
4. Complete Installation
• Wait for the installation to finish.
• When prompted, you can launch Code::Blocks immediately by clicking Finish.
• If you downloaded the installer with MinGW, the GCC compiler will be
automatically set up.
5. Set Up Environment Variables (if necessary)
7th, KM Haridwar, National Highway Vardhmanpuram,
Roorkee, Rehmadpur, Uttarakhand 247667

• Sometimes, you may need to add the MinGW bin folder to your system’s PATH.
• Copy the path (like C:\Program Files\CodeBlocks\MinGW\bin).
• Go to System Properties > Environment Variables > Path > Edit > New, and
paste the copied path, clicking OK to save.

How Code::Blocks Works


1. Integrated Development Environment (IDE): Code::Blocks includes a text editor for
writing code, a compiler for building C/C++ programs, a debugger, and a project
manager to organize files.
2. Plugin Architecture: Its features and capabilities can be expanded with plugins.
3. Multiple Project Support: You can manage multiple projects and files within a single
workspace.
4. Compiler Binding: Comes pre-packaged with the GCC/MinGW compiler, or you can
configure a preferred one.

How to Write and Run C++ Code in Code::Blocks


1. Start Code::Blocks
2. Create a New Project
• Go to File > New > Project.
• Choose Console Application (for basic C/C++ apps), select C++ as the
language, and complete the wizard.
• Set the project title and folder, then finish.
3. Edit the Source File
• Through the left “Projects” pane, double-click the source file
(usually main.cpp).
• Write or paste your C++ code in the editor area.
4. Build and Run the Program
• Click the Build & Run button (a single green “Play” icon with a gear).
• The IDE will compile your project, display build messages, and then run your
program in a console window.
• Output appears, and you can close the console when done.
7th, KM Haridwar, National Highway Vardhmanpuram,
Roorkee, Rehmadpur, Uttarakhand 247667
CODE EXAMPLE:

#include <iostream>
using namespace std;

int main() {
cout << "Hello World!";
return 0;
}
Save the file as main.cpp, then use Build > Build and Run

Summary Table: Main Steps

Step Description

Download Installer Via official Code::Blocks website

Installation Run, agree to terms, default location

Launch Code::Blocks Start from Start Menu or after install

New Project File → New → Project → Console Application

Edit Code Write C++ in editor (e.g., main.cpp)

Build & Run Click Build & Run to compile and execute

You can repeat the process to work with new projects, and organize files as projects become
more complex

You might also like