0% found this document useful (0 votes)
81 views5 pages

CPP Full Course Notes

This document provides comprehensive notes on C++, covering its introduction, basic structure, data types, input/output, operators, conditional statements, loops, functions, arrays, strings, pointers, OOP concepts, file handling, exception handling, and the Standard Template Library (STL). Each section includes code examples to illustrate the concepts discussed. The notes serve as a complete guide for learning C++ programming.

Uploaded by

kingsuvathikan
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)
81 views5 pages

CPP Full Course Notes

This document provides comprehensive notes on C++, covering its introduction, basic structure, data types, input/output, operators, conditional statements, loops, functions, arrays, strings, pointers, OOP concepts, file handling, exception handling, and the Standard Template Library (STL). Each section includes code examples to illustrate the concepts discussed. The notes serve as a complete guide for learning C++ programming.

Uploaded by

kingsuvathikan
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/ 5

C++ FULL COURSE NOTES

1. INTRODUCTION

- C++ is an object-oriented programming language created by Bjarne Stroustrup.

- It supports OOP concepts such as classes, inheritance, polymorphism.

2. BASIC STRUCTURE

#include <iostream>

using namespace std;

int main() {

cout << "Hello World!";

return 0;

3. VARIABLES & DATA TYPES

int age = 20;

float salary = 45000.50;

char grade = 'A';

bool isPassed = true;

string name = "Suvathikan";

4. INPUT / OUTPUT

cin >> age;

cout << age;

5. OPERATORS
- Arithmetic: + - * / %

- Assignment: = += -=

- Comparison: == != > < >= <=

- Logical: && || !

6. CONDITIONAL STATEMENTS

if (age >= 18) {

cout << "Adult";

} else {

cout << "Minor";

switch(day) {

case 1: cout << "Monday"; break;

default: cout << "Other day";

7. LOOPS

for (int i = 0; i < 5; i++) { cout << i; }

while (i < 5) { cout << i; i++; }

do { cout << i; i++; } while (i < 5);

8. FUNCTIONS

int add(int a, int b) {

return a + b;

}
9. ARRAYS

int arr[3] = {10, 20, 30};

cout << arr[0];

10. STRINGS

string name = "Suvathikan";

cout << name.length();

11. POINTERS

int x = 10;

int* ptr = &x;

cout << *ptr;

12. OOP CONCEPTS

a) CLASS & OBJECT

class Car {

public:

string brand;

void start() {

cout << "Starting car";

};

Car c1;

c1.start();

b) CONSTRUCTOR
class Student {

public:

Student() {

cout << "Constructor called";

};

c) INHERITANCE

class Animal {

public:

void speak() { cout << "Sound"; }

};

class Dog : public Animal {};

d) POLYMORPHISM

class A { public: void show() { cout << "A"; } };

class B : public A { public: void show() { cout << "B"; } };

13. FILE HANDLING

#include <fstream>

ofstream file("data.txt");

file << "Writing to file";

file.close();

14. EXCEPTION HANDLING

try {

// code
} catch (exception &e) {

cout << e.what();

15. STL (STANDARD TEMPLATE LIBRARY)

- vector, map, set, queue

- #include <vector>

vector<int> v = {1, 2, 3};

v.push_back(4);

cout << v[0];

END OF COURSE

You might also like