← All languages

C++ programs

From Hello World through STL-sized problems.

19 topics · 165 examples · ordered like a syllabus

Open Hello World

Topics, in order

Finish one. The next is the card below.

  1. 01Basic ProgramsBasic C++ programs for cout, cin, types, and simple math. First week, walked line by line, with the input traps and integer-division surprises that catch beginners.
    • Hello World
    • Display Your Name
    • User Input
    14 programs →
  2. 02Conditional ProgramsC++ programs that make decisions with if, else if, and else: even/odd, the largest of three, vowels, and leap years, with the edge cases teachers test.
    • Check for Even Odd
    • Largest Among 3
    • Vowel/Consonant Check
    4 programs →
  3. 03Loop ProgramsC++ loop programs with for and while: tables, sums, factorials, digit tricks, GCD, primes, Fibonacci, and a switch calculator. Each one traced by hand, step by step.
    • Multiplication Table
    • Sum of n Natural Numbers
    • Factorial of a Number
    14 programs →
  4. 04Pattern ProgramsStar and number pattern programs in C++ built with nested for loops: half pyramids, full and inverted pyramids, a number triangle, and Pascal's triangle.
    • Right Half Pyramid
    • Left Half Pyramid
    • Full Pyramid
    6 programs →
  5. 05Array ProgramsC++ array programs for beginners: find the max and min, average the values, merge two arrays, and read a 2D matrix, with index rules and size traps explained.
    • Array Max & Min
    • Array Average
    • Merge Arrays
    4 programs →
  6. 06String Conversion ProgramsC++ type conversion programs: char, int, double, string, and char arrays converted back and forth with casts, stoi, stod, to_string, and stringstream.
    • Convert Char to String
    • Convert Integer to Char
    • Convert String to Integer
    11 programs →
  7. 07Advanced Number ProgramsAdvanced C++ number programs: strong, neon, and narcissistic checks, powers, compound interest, digit reversal, and conversions between binary, octal, and decimal.
    • Check Strong Number
    • Calculate Power of a Number
    • Compound Interest: Precision and Compounding Periods
    13 programs →
  8. 08String Operations ProgramsC++ string operation programs: copy, join, reverse, check palindromes, remove vowels, characters, or spaces, count letters, and read ASCII codes, with several methods each.
    • Copy Strings
    • Concatenate Two Strings
    • Reverse a String
    10 programs →
  9. 09Array Operations ProgramsC++ array operation programs: reverse and merge arrays, merge sorted arrays, average numbers, transpose and multiply matrices, and collect factors in a vector.
    • Reverse an Array
    • Merge Two Sorted Arrays
    • Merge Two Arrays
    7 programs →
  10. 10Advanced Pattern ProgramsAdvanced C++ pattern programs that print several shapes per run: star sets, hollow triangles, diamonds, hollow pyramids, number triangles, and Floyd's triangle.
    • Star Pattern
    • Triangle Pattern
    • Diamond Pattern
    6 programs →
  11. 11Application ProgramsSmall C++ application programs that combine loops, switch, functions, and parsing: a menu-driven calculator, a scientific calculator, and a date string parser.
    • Menu Driven Program
    • Scientific Calculator
    • Convert String to Date
    3 programs →
  12. 12Sorting & Searching ProgramsSorting and searching in C++: bubble, insertion, selection, merge, quick, heap, radix, and counting sort, plus linear, binary, jump, and interpolation search, all traced.
    • Bubble Sort
    • Insertion Sort
    • Selection Sort
    13 programs →
  13. 13Object-Oriented ProgrammingObject-oriented programming in C++: classes, constructors, destructors, static members, five kinds of inheritance, overloading, virtual functions, abstract classes, friends, and this.
    • Class and Object Basics
    • Default Constructor
    • Parameterized Constructor
    18 programs →
  14. 14Memory Management ProgramsC++ memory programs: pointers, pointer arithmetic, double pointers, function pointers, nullptr, new and delete, dynamic arrays and objects, leak prevention, and smart pointers.
    • Basic Pointers
    • Pointer Arithmetic
    • Pointer to Pointer
    11 programs →
  15. 15STL Containers ProgramsC++ STL container programs with output: vector, 2D vector, map, set, unordered_map, stack, queue, priority_queue, and deque, with when to pick each one.
    • Vector Basics
    • Vector Operations
    • 2D Vector
    10 programs →
  16. 16File Handling ProgramsC++ file handling programs with fstream: write, read line by line and word by word, append, binary read and write, check if a file exists, and copy files.
    • Write to File
    • Read from File
    • Append to File
    6 programs →
  17. 17Exception Handling ProgramsC++ exception handling programs: try, catch, and throw, multiple catch blocks, custom exception classes, noexcept, nested try-catch, and rethrowing errors.
    • Basic try-catch
    • Multiple catch Blocks
    • Custom Exception Class
    5 programs →
  18. 18Recursion ProgramsC++ recursion programs with dry runs: factorial, Fibonacci, Tower of Hanoi, GCD with Euclid's algorithm, and fast power, with base cases and call stack depth.
    • Factorial using Recursion
    • Fibonacci using Recursion
    • Tower of Hanoi
    5 programs →
  19. 19Bitwise Operations ProgramsC++ bitwise operator programs: AND, OR, XOR, NOT, and shifts, checking and setting bits, counting set bits, XOR swap, and finding missing numbers with XOR.
    • Basic Bitwise Operations
    • Check and Set Bits
    • Count Set Bits
    5 programs →