Ai Notes

Learn C++ Basics with Programming Fundamentals Lab Report (1) C++


Welcome to Your First Step in C++ Programming!

Hey there, aspiring coder! If you’re just starting your journey into the world of programming, you’re in the right place. Today, we’re breaking down the Programming Fundamentals Lab Report (1) C++, a fantastic hands-on way to get comfy with C++ and its core concepts. Whether you’re a student tackling your first lab assignment or a curious beginner, this guide is written just for you—with a friendly tone and zero jargon overload. Let’s dive in and have some fun with code!


What’s This Lab Report All About?

The Programming Fundamentals Lab Report (1) C++ is your ticket to understanding the basics of C++ programming and Object-Oriented Programming (OOP). It’s designed to help you:

  • Get familiar with the C++ programming language.
  • Grasp the magic of OOP concepts.
  • Learn how to write and compile code using Dev C++.
  • Build a foundation for creating software.

In this lab, we’ll walk through four simple tasks that teach you how to use the cout statement, declare variables, perform basic operations, and even print cool patterns. Ready? Let’s explore each task together!


Tools You’ll Need: Dev C++

Before we jump into the code, you’ll need Dev C++, a free and lightweight Integrated Development Environment (IDE) perfect for beginners. It’s super easy to set up, and you can download it here if you haven’t already. Once installed, you’re ready to start coding like a pro!


Lab Task 1: Printing Your Name Like a Rockstar

What’s the Goal?

Write a program that prints your first name, last name, and registration number on separate lines using only the cout statement.

The Code

#include <iostream> using namespace std;

int main() { cout << “First name: Laiba” << endl; cout << “Surname: Bashir” << endl; cout << “Registration No. 24-AI-033” << endl; return 0; }

What You’ll See

First name: Laiba Surname: Bashir Registration No. 24-AI-033

Why It Works

  • #include <iostream>: This is a header file that lets us use cout to print stuff.
  • using namespace std;: Saves us from typing std:: every time we use cout.
  • int main(): The starting point of every C++ program.
  • cout << “text” << endl;: Prints your text and moves to the next line.
  • return 0: Tells the program, “Hey, I’m done!”

Pretty cool, right? You just wrote your first C++ program!


Lab Task 2: Displaying Two Characters

What’s the Goal?

Print the two characters “AB” with a little message.

The Code

#include <iostream> using namespace std;

int main() { cout << “Two characters are” << endl; cout << “AB” << endl; return 0; }

What You’ll See

Two characters are AB

Why It Works

This one’s a breeze! We’re just using cout again to display a message, followed by “AB” on a new line thanks to endl. It’s a simple way to get comfy with output in C++.


Lab Task 3: Adding Numbers Like a Math Whiz

What’s the Goal?

Write a program to find the sum of 4 and 5.

The Code

#include <iostream> using namespace std;

int main() { int a, b, c; a = 4; b = 5; c = a + b; cout << “Sum of 4 & 5 is: ” << c << endl; return 0; }

What You’ll See

Sum of 4 & 5 is: 9

Why It Works

  • int a, b, c;: Declares three integer variables.
  • a = 4; b = 5;: Assigns values to a and b.
  • c = a + b;: Adds them and stores the result in c.
  • cout: Shows the result to the world!

This task introduces variables and basic arithmetic—core building blocks for any program.


Lab Task 4: Printing a Fun Pattern

What’s the Goal?

Print a vertical column of five # symbols.

The Code

#include <iostream> using namespace std;

int main() { cout << “#” << endl; cout << “#” << endl; cout << “#” << endl; cout << “#” << endl; cout << “#” << endl; return 0; }

What You’ll See

Why It Works

We’re using cout five times, each followed by endl to move to the next line. It’s a simple way to create a pattern—and trust me, patterns get way more exciting as you level up in programming!


Why This Lab Matters

The Programming Fundamentals Lab Report (1) C++ isn’t just about typing code—it’s about understanding how C++ works under the hood. You’ve learned:

  • How to set up and use Dev C++.
  • The role of header files like <iostream>.
  • Why int main() is the heart of your program.
  • How to use cout for output and variables for calculations.

These basics are your stepping stones to mastering OOP and building awesome software down the road.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top