What is C++?
•• General-purpose programming language
• • Developed by Bjarne Stroustrup in 1979
• • Combines procedural and object-oriented
paradigms
• • Known for performance and low-level
memory control
3.
Key Features ofC++
• • Object-Oriented Programming (OOP)
• • Strong type checking
• • Direct hardware access
• • Memory management via pointers
• • Standard Template Library (STL)
• • Fast execution speed
4.
First C++ Program
•#include <iostream>
• using namespace std;
• int main() {
• cout << "Hello, World!";
• return 0;
• }
5.
Data Types inC++
• • int - Integer (e.g., 10)
• • float - Decimal (e.g., 10.5)
• • char - Character (e.g., 'A')
• • bool - Boolean (true/false)
• • string - Text string (C++11+)
6.
Control Structures
• if(x > 0) {
• cout << "Positive";
• } else {
• cout << "Non-positive";
• }
• for (int i = 0; i < 5; i++) {
• cout << i << " ";
• }
7.
Functions in C++
•int add(int a, int b) {
• return a + b;
• }
• int main() {
• cout << add(3, 4);
• }
Summary
• • Powerful,efficient programming language
• • Supports procedural and OOP
• • Covered: syntax, data types, control
structures, functions, classes
• • Used in game dev, embedded, and system
programming
10.
Further Resources
• •https://cplusplus.com
• • https://w3schools.com/cpp/
• • Book: 'Programming Principles and Practice
Using C++' - Bjarne Stroustrup
11.
Activity Question
• 🧠**Challenge:**
• Write a C++ program that:
• - Asks the user to enter two numbers
• - Outputs their sum using a custom function
• 💡 Try it on your own, then compare with
peers!