noknow.dev
Sign inSign up
Course overview
C++ Fundamentals
0 / 39 lessons0%

Getting Started

  • Hello, World!
  • Variables and Data Types
  • Arithmetic and Operators
  • Working with std::string
  • Type Conversion and Casting

Control Flow

  • if / else if / else
  • switch / case
  • while and do-while Loops
  • for Loops
  • break, continue, and Finding Primes

Functions

  • Writing Functions
  • Pass by Value vs. Pass by Reference
  • Overloading and Default Parameters
  • Recursion

Arrays and Strings

  • C-style Arrays
  • std::vector — Dynamic Arrays
  • std::string Deep Dive
  • 2D Arrays and Matrices

Pointers and Memory

  • Memory Addresses and Pointers
  • Dynamic Memory: new and delete
  • References vs Pointers

Object-Oriented Programming

  • Classes and Objects
  • Constructors and Destructors
  • Inheritance
  • Virtual Functions and Polymorphism
  • Operator Overloading

The Standard Template Library

  • std::vector in Depth
  • std::map and std::unordered_map
  • std::set and Sorted Unique Collections
  • STL Algorithms

Templates and Generic Programming

  • Function Templates
  • Class Templates

Modern C++ (C++11/14/17)

  • auto and Range-based for
  • Lambda Functions
  • Smart Pointers
  • Move Semantics

Error Handling and Exceptions

  • try / catch / throw
  • Custom Exception Classes
  • RAII and Resource Management

Arithmetic and Operators

0m 00s

Math in C++

cout << 10 + 3;   // 13  addition
cout << 10 - 3;   // 7   subtraction
cout << 10 * 3;   // 30  multiplication
cout << 10 / 3;   // 3   integer division (truncates!)
cout << 10.0/3;   // 3.333...  float division
cout << 10 % 3;   // 1   remainder (modulo)

Integer vs Float Division

int a = 7, b = 2;
cout << a / b;           // 3  (integer, drops decimal)
cout << (double)a / b;   // 3.5

Shorthand

x += 5;  x -= 2;  x *= 3;  x /= 4;
x++;     ++x;     x--;     --x;

Your Task

Write hypotenuse(double a, double b) using the Pythagorean theorem.
Formula: c = sqrt(a*a + b*b). Use #include <cmath>.

Back
cppCtrl+Enter to run
Output

Click "Run" to execute your code.