C++ Basics Examples

Key takeaway: Practice C++ with 63+ runnable code examples — I/O, loops, math, strings, arrays, pointers, classes, and operator overloading — all with expected output to verify your understanding.

C++ is a general-purpose, object-oriented programming language used for game engines, system software, embedded devices, and high-performance applications. These examples are for CS students, interview candidates, and developers building C++ skills.

Last updated: October 2026 · 63 examples · All platforms

Quick Start

  1. Pick an example from the sidebar or mobile menu
  2. Study the C++ source code and expected output
  3. Run it in our online C++ compiler or local g++/clang++ compiler
  4. Modify the code to experiment with vectors, classes, and pointers

Who is this for: CS students, game dev learners, competitive programmers, and job seekers preparing for C++ interviews. Use this when: you need verified C++ reference code or practice problem solutions.

Related:Online C++ Compiler · C++ Tutorial · C Examples

C++ Program to Check Whether Number is Even or Odd

Run Online

Checks parity using modulo.

Program (C++)
#include <iostream>
int main(){
    int n=7;
    std::cout << n << " is " << (n%2==0?"even":"odd") << std::endl;
    return 0;
}
Expected Output
7 is odd

C++ "Hello, World!" Program

Run Online

Prints a greeting to the console.

Program (C++)
#include <iostream>
int main(){
    std::cout << "Hello, World!" << std::endl;
    return 0;
}
Expected Output
Hello, World!

C++ Program to Print Number Entered by User

Run Online

Demonstrates integer I/O (using a sample value).

Program (C++)
#include <iostream>
int main(){
    int n = 123;
    std::cout << "You entered: " << n << std::endl;
    return 0;
}
Expected Output
You entered: 123

C++ Program to Add Two Numbers

Run Online

Adds two integers and prints the sum.

Program (C++)
#include <iostream>
int main(){
    int a=3,b=5;
    std::cout << "Sum = " << (a+b) << std::endl;
    return 0;
}
Expected Output
Sum = 8

C++ Program to Find Quotient and Remainder

Run Online

Integer division and modulo.

Program (C++)
#include <iostream>
int main(){
    int a=20,b=3;
    std::cout << "Quotient = " << (a/b) << "\nRemainder = " << (a%b) << std::endl;
    return 0;
}
Expected Output
Quotient = 6
Remainder = 2

C++ Program to Find Size of int, float, double and char in Your System

Run Online

Uses sizeof operator.

Program (C++)
#include <iostream>
int main(){
    std::cout << "sizeof(char) = " << sizeof(char) << "\n";
    std::cout << "sizeof(int) = " << sizeof(int) << "\n";
    std::cout << "sizeof(float) = " << sizeof(float) << "\n";
    std::cout << "sizeof(double) = " << sizeof(double) << std::endl;
    return 0;
}
Expected Output
sizeof(char) = 1
sizeof(int) = 4
sizeof(float) = 4
sizeof(double) = 8

C++ Program to Swap Two Numbers

Run Online

Swaps using temp variable.

Program (C++)
#include <iostream>
int main(){
    int a=3,b=4,temp;
    temp=a; a=b; b=temp;
    std::cout << "a = " << a << ", b = " << b << std::endl;
    return 0;
}
Expected Output
a = 4, b = 3

C++ Program to Check Whether a character is Vowel or Consonant

Run Online

Checks vowel set.

Program (C++)
#include <iostream>
#include <cctype>
int main(){
    char c='e';
    c = (char)std::tolower((unsigned char)c);
    bool v = (c=='a'||c=='e'||c=='i'||c=='o'||c=='u');
    std::cout << c << " is " << (v?"vowel":"consonant") << std::endl;
    return 0;
}
Expected Output
e is vowel

C++ Program to Find All Roots of a Quadratic Equation

Run Online

Quadratic formula for ax^2+bx+c.

Program (C++)
#include <iostream>
#include <cmath>
int main(){
    double a=1,b=-3,c=2;
    double d = b*b - 4*a*c;
    if(d>=0){
        double r1=(-b + std::sqrt(d))/(2*a);
        double r2=(-b - std::sqrt(d))/(2*a);
        std::cout << "Roots: " << r1 << ", " << r2 << std::endl;
    } else {
        std::cout << "Complex roots" << std::endl;
    }
    return 0;
}
Expected Output
Roots: 2, 1

C++ Program to Check Leap Year

Run Online

Checks leap year rules.

Program (C++)
#include <iostream>
int main(){
    int y=2024;
    bool leap = (y%4==0 && y%100!=0) || (y%400==0);
    std::cout << y << " is " << (leap?"leap year":"not leap year") << std::endl;
    return 0;
}
Expected Output
2024 is leap year

Increment ++ and Decrement -- Operator Overloading in C++ Programming

Run Online

Demonstrates custom ++/-- for a class.

Program (C++)
#include <iostream>
struct Counter{
    int value;
    Counter(int v=0):value(v){}
    Counter& operator++(){ value++; return *this; }      // pre-increment
    Counter operator++(int){ Counter tmp=*this; value++; return tmp; } // post-increment
    Counter& operator--(){ value--; return *this; }
    Counter operator--(int){ Counter tmp=*this; value--; return tmp; }
};
int main(){
    Counter c(5);
    ++c; c++; --c; c--;
    std::cout << "Counter = " << c.value << std::endl;
    return 0;
}
Expected Output
Counter = 5

C++ Program to Subtract Complex Number Using Operator Overloading

Run Online

Defines Complex with operator-.

Program (C++)
#include <iostream>
struct Complex{ double re, im; };
Complex operator-(const Complex& a, const Complex& b){ return {a.re-b.re, a.im-b.im}; }
int main(){
    Complex a{3.5, 2.0}, b{2.0, 0.5};
    Complex c = a - b;
    std::cout << c.re << " + " << c.im << "i" << std::endl;
    return 0;
}
Expected Output
1.5 + 1.5i

C++ Program to Find ASCII Value of a Character

Run Online

Prints ASCII of a character.

Program (C++)
#include <iostream>
int main(){
    char ch='A';
    std::cout << "ASCII of " << ch << " = " << (int)ch << std::endl;
    return 0;
}
Expected Output
ASCII of A = 65

C++ Program to Multiply two Numbers

Run Online

Multiplies two numbers.

Program (C++)
#include <iostream>
int main(){
    int a=7,b=6;
    std::cout << "Product = " << (a*b) << std::endl;
    return 0;
}
Expected Output
Product = 42

C++ Programs To Create Pyramid and Pattern

Run Online

Simple star pyramid.

Program (C++)
#include <iostream>
int main(){
    int n=5;
    for(int i=1;i<=n;i++){
        for(int s=0;s<n-i;s++) std::cout << ' ';
        for(int j=0;j<2*i-1;j++) std::cout << '*';
        std::cout << '\n';
    }
    return 0;
}
Expected Output
    *
   ***
  *****
 *******
*********

C++ Program to Calculate Standard Deviation

Run Online

Computes population std dev.

Program (C++)
#include <iostream>
#include <cmath>
int main(){
    double a[]={2,4,4,4,5,5,7,9}; int n=8; double sum=0;
    for(int i=0;i<n;i++) sum+=a[i]; double mean=sum/n;
    double v=0; for(int i=0;i<n;i++) v+=(a[i]-mean)*(a[i]-mean); v/=n;
    std::cout << "StdDev = " << std::sqrt(v) << std::endl;
    return 0;
}
Expected Output
StdDev = 2

C++ Program to Swap Numbers in Cyclic Order Using Call by Reference

Run Online

Cyclic swap a->b->c.

Program (C++)
#include <iostream>
void cyclic(int& a,int& b,int& c){ int t=c; c=b; b=a; a=t; }
int main(){
    int a=1,b=2,c=3; cyclic(a,b,c);
    std::cout << "a=" << a << " b=" << b << " c=" << c << std::endl;
    return 0;
}
Expected Output
a=3 b=1 c=2

C++ Program to Find the Frequency of Characters in a String

Run Online

Counts frequency of a given char.

Program (C++)
#include <iostream>
#include <string>
int main(){
    std::string s="hello world"; char ch='l'; int c=0;
    for(char x: s) if(x==ch) c++;
    std::cout << "'" << ch << "' occurs " << c << " times" << std::endl;
    return 0;
}
Expected Output
'l' occurs 3 times

C++ Program to Find the Number of Vowels, Consonants, Digits and White Spaces in a String

Run Online

Classifies characters.

Program (C++)
#include <iostream>
#include <cctype>
int main(){
    const char* s="Hello World 123!"; int v=0,cons=0,d=0,sp=0,oth=0;
    for(int i=0;s[i];i++){ unsigned char c=s[i]; if(std::isalpha(c)){ char t=(char)std::tolower(c); if(t=='a'||t=='e'||t=='i'||t=='o'||t=='u') v++; else cons++; } else if(std::isdigit(c)) d++; else if(std::isspace(c)) sp++; else oth++; }
    std::cout << "Vowels=" << v << " Consonants=" << cons << " Digits=" << d << " Spaces=" << sp << " Others=" << oth << std::endl;
    return 0;
}
Expected Output
Vowels=3 Consonants=7 Digits=3 Spaces=2 Others=1

C++ Program to Remove all Characters in a String Except Alphabets

Run Online

Filters only letters.

Program (C++)
#include <iostream>
#include <cctype>
int main(){
    const char* s="H3ll0, W0rld!"; char o[100]; int j=0;
    for(int i=0;s[i];i++){ if(std::isalpha((unsigned char)s[i])) o[j++]=s[i]; } o[j]='\0';
    std::cout << o << std::endl;
    return 0;
}
Expected Output
HllWrld

C++ Program to Find the Length of a String

Run Online

Uses std::string length.

Program (C++)
#include <iostream>
#include <string>
int main(){
    std::string s="hello"; std::cout << "Length = " << s.length() << std::endl;
    return 0;
}
Expected Output
Length = 5

C++ Program to Concatenate Two Strings

Run Online

Uses string concatenation.

Program (C++)
#include <iostream>
#include <string>
int main(){
    std::string a="Hello", b=" World"; std::cout << (a+b) << std::endl;
    return 0;
}
Expected Output
Hello World

C++ Program to Copy Strings

Run Online

Uses assignment operator.

Program (C++)
#include <iostream>
#include <string>
int main(){
    std::string s="Sample"; std::string d = s;
    std::cout << d << std::endl;
    return 0;
}
Expected Output
Sample

C++ Program to Sort Elements in Lexicographical Order (Dictionary Order)

Run Online

Sorts array of strings.

Program (C++)
#include <iostream>
#include <vector>
#include <algorithm>
int main(){
    std::vector<std::string> s = {"banana","apple","cherry"};
    std::sort(s.begin(), s.end());
    std::cout << s[0] << ' ' << s[1] << ' ' << s[2] << std::endl;
    return 0;
}
Expected Output
apple banana cherry

C++ Program to Store Information of a Student in a Structure

Run Online

Defines struct and prints.

Program (C++)
#include <iostream>
#include <string>
struct Student{ std::string name; int age; double marks; };
int main(){
    Student s{"Alice",20,92.5};
    std::cout << s.name << ' ' << s.age << ' ' << s.marks << std::endl;
    return 0;
}
Expected Output
Alice 20 92.5

C++ Program to Add Two Distances (in inch-feet) System Using Structures

Run Online

Adds feet-inch distances.

Program (C++)
#include <iostream>
struct Dist{ int feet; int inch; };
int main(){
    Dist a{5,8}, b{3,11}, c{};
    c.feet=a.feet+b.feet; c.inch=a.inch+b.inch;
    if(c.inch>=12){ c.feet+=c.inch/12; c.inch%=12; }
    std::cout << c.feet << " feet " << c.inch << " inch" << std::endl;
    return 0;
}
Expected Output
9 feet 7 inch

C++ Program to Add Complex Numbers by Passing Structure to a Function

Run Online

Adds complex numbers.

Program (C++)
#include <iostream>
struct Complex{ double re, im; };
Complex add(Complex a,Complex b){ return {a.re+b.re, a.im+b.im}; }
int main(){
    Complex a{1.5,2.0}, b{2.5,3.0}; Complex c=add(a,b);
    std::cout << c.re << " + " << c.im << "i" << std::endl;
    return 0;
}
Expected Output
4 + 5i

C++ Program to Calculate Difference Between Two Time Period

Run Online

Subtracts times with borrow.

Program (C++)
#include <iostream>
struct Time{ int h,m,s; };
int main(){
    Time a{2,40,30}, b{1,20,50}, d{};
    if(b.s>a.s){ b.m++; a.s+=60; } d.s=a.s-b.s;
    if(b.m>a.m){ b.h++; a.m+=60; } d.m=a.m-b.m;
    d.h=a.h-b.h;
    std::cout << (d.h<10?"0":"") << d.h << ":" << (d.m<10?"0":"") << d.m << ":" << (d.s<10?"0":"") << d.s << std::endl;
    return 0;
}
Expected Output
01:19:40

Frequently Asked Questions

Use g++ or clang++. Run: g++ program.cpp -std=c++17 -O2 -o program && ./program. Or use our free online C++ compiler.

C++11 and above. Most use C++17 features. Set -std=c++17 flag when compiling.

Yes, absolutely. Copy, modify inputs, add edge cases — experimentation is the fastest way to learn C++.

Yes, fully cross-platform. Tested on Windows, macOS, and Linux with g++, clang++, and MSVC.

Who Should Practice These C++ Examples?

Who is this for: Multiple audiences across industries and experience levels:

  • CS students — university exams, data structures labs, programming assignments
  • Self-taught developers — career switching into game dev, systems programming, or embedded
  • Interview candidates — coding patterns asked at Google, Amazon, Microsoft, and game studios
  • Embedded engineers — refreshing syntax for IoT, automotive, or firmware
  • Game developers — Unreal Engine patterns, inheritance, memory management
  • Competitive programmers — speed drilling on algorithms and STL

Use this when: you need verified reference code, want to complete an assignment, prepare for interviews, or warm up before a systems/game project. Best for beginners through intermediate-level programmers.

Why Practice C++ in 2026?

The TIOBE Index ranked C++ as #2 in 2024. It powers:

  • Games: Unreal Engine, AAA studios, Unity native plugins
  • Finance: High-frequency trading (microsecond latency)
  • Automotive: Tesla, Waymo, BMW self-driving systems
  • Embedded/IoT: Resource-constrained devices
  • OS: Windows, ChromeOS, Linux kernel modules

C++ roles pay $120K–$200K+ in these industries.

How to Get the Most from These Examples

  1. Read first — predict the output before checking
  2. Type it — don't copy-paste; typing builds memory
  3. Break it — change values, add edge cases, observe results
  4. Explain it — if you can explain each line, you understand it
  5. Extend it — combine concepts into small projects

C++ vs C — Quick Comparison

FeatureC++C
OOPClasses, inheritance, polymorphismNo
STLvector, map, set, algorithmsManual arrays
Memorynew/delete + smart pointersmalloc/free
Stringsstd::stringchar arrays
Errorstry/catch exceptionsError codes

Related:C++ Tutorial · Online C++ Compiler · C Examples

C++ Career Guide — Jobs, Salaries & Getting Hired

What Jobs Can You Get With C++ Skills?

Direct answer: C++ developers work in high-performance computing, game development, finance, embedded systems, and infrastructure. Key roles include:

  • Game Developer: Unreal Engine, Unity internals, game physics engines (Epic Games, EA, Ubisoft)
  • Quantitative Developer: High-frequency trading systems, risk models (Goldman Sachs, Citadel, Tower Research)
  • Systems/Infrastructure Engineer: Databases, compilers, OS components (Google, Meta, Microsoft)
  • Embedded Software Engineer: Automotive ECUs, robotics, IoT firmware (Tesla, Bosch, Qualcomm)
  • Graphics/Vision Engineer: Computer vision, AR/VR, rendering pipelines (NVIDIA, Apple, Adobe)
  • Compiler/Toolchain Engineer: LLVM, GCC, language runtimes (Apple, Intel, ARM)

Is C++ Worth Learning for Job Opportunities?

Absolutely yes. C++ is one of the highest-paying programming languages because the jobs that require it are technically demanding and mission-critical. While there are fewer C++ jobs than JavaScript or Python jobs in raw count, C++ positions pay 20–40% more on average because the supply of skilled C++ developers is much smaller than demand. According to the StackOverflow 2024 Survey, C++ developers rank among the top 5 highest-paid globally.

How Much Do C++ Programmers Make?

ExperienceIndia (LPA)USA (USD/year)Typical Role
Fresher (0–1 yr)₹5–10 LPA$70,000–$100,000Junior Developer
Mid (3–5 yrs)₹15–30 LPA$120,000–$160,000Software Engineer
Senior (5–10 yrs)₹30–60 LPA$160,000–$250,000Senior/Staff Engineer
Quant/HFT₹50–1.5 Cr$200,000–$500,000+Quantitative Developer

Can You Get a Job With Just C++ Knowledge?

Yes, but you'll need complementary skills. C++ alone gets you interviews, but companies also expect: data structures & algorithms (essential for all C++ roles), one domain specialization (game dev, embedded, finance), familiarity with build tools (CMake, Make), and version control (Git). For embedded roles, add hardware knowledge. For game dev, add linear algebra and a game engine. For finance, add math/statistics.

What Companies Hire C++ Developers?

Top employers by category:

  • Big Tech: Google (Chrome, Android), Microsoft (Windows, Office), Apple (macOS, iOS internals), Meta (infrastructure)
  • Gaming: Epic Games, EA, Ubisoft, Rockstar, Riot Games, Blizzard
  • Finance/HFT: Citadel, Two Sigma, Tower Research, DE Shaw, Jane Street, Goldman Sachs
  • Automotive: Tesla, Waymo, BMW, Continental, Bosch, NVIDIA (self-driving)
  • India-specific: Samsung R&D, Qualcomm Hyderabad, Goldman Sachs Bangalore, Morgan Stanley, Tower Research Gurgaon, Directi

How Long Does It Take to Learn C++ for Jobs?

Timeline:

  1. Month 1–2: Basics — syntax, OOP, pointers, memory management, STL containers
  2. Month 3–4: Intermediate — templates, smart pointers, move semantics, RAII, exception handling
  3. Month 5–6: Advanced — multithreading, design patterns, build systems, profiling
  4. Month 7–9: Domain specialization — pick one area (games, embedded, finance) and build projects
  5. Month 10–12: Interview prep — LeetCode in C++, system design, past company questions

Total: 9–12 months of consistent daily practice (2–3 hours/day) to be job-ready for entry-level C++ positions.

Is C++ Harder to Learn Than Python?

Yes, significantly. C++ has manual memory management, pointers, templates, multiple inheritance, undefined behavior, and a complex compilation model. Python abstracts all of this away. However, learning C++ first makes you a stronger programmer overall because you understand what's happening "under the hood." Developers who know C++ find Python trivially easy to learn later — the reverse is much harder.

What Do C++ Interviews Actually Ask About?

Core interview topics:

  • Data Structures: Implement hash maps, trees, graphs, linked lists from scratch
  • Memory Management: Stack vs heap, smart pointers, RAII, memory leaks, dangling pointers
  • OOP: Virtual functions, vtable, multiple inheritance, diamond problem, abstract classes
  • STL: Containers (vector, map, unordered_map), iterators, algorithms, custom comparators
  • Concurrency: Threads, mutexes, atomic operations, lock-free data structures
  • Move Semantics: lvalue/rvalue references, std::move, perfect forwarding, copy elision
  • System Design: Design a cache, thread pool, memory allocator, or message queue

Do I Need to Be an Expert in C++ to Get Hired?

No. Entry-level positions expect you to know: basic syntax, OOP, pointers, STL basics, and solve medium-level DSA problems in C++. You don't need to understand template metaprogramming, SFINAE, or write lock-free code for your first job. That comes with experience. Focus on: clean code, correct memory management, and problem-solving ability.

C++ vs Other Languages: Which Pays Better?

LanguageAvg Salary (US)Avg Salary (India)Job Availability
C++$135,000₹18 LPAModerate (niche)
Python$120,000₹12 LPAVery High
Java$115,000₹14 LPAHigh
Rust$140,000₹20 LPALow (growing)
Go$130,000₹16 LPAModerate

C++ pays more per role because the jobs are harder and candidates are fewer. HFT (high-frequency trading) C++ roles are the highest-paid programming jobs in the world.

What Are the Easiest C++ Jobs for Beginners?

  • QA/Test Automation (C++): Writing test frameworks for C++ codebases — lower bar than development
  • Junior Embedded Developer: Firmware for simple microcontrollers — companies like TCS, Infosys hire freshers
  • Competitive Programming → Job: Good Codeforces rating (1400+) in C++ opens doors at product companies
  • Game QA → Game Developer: Start in testing, transition to gameplay programming
  • Build/DevOps for C++ projects: Managing CI/CD pipelines for C++ codebases (CMake, Conan, Bazel)

How to Prepare for a C++ Job Interview?

  1. DSA in C++: Solve 150+ LeetCode problems (focus on medium) using STL and raw pointers
  2. C++ language specifics: Study virtual functions, RAII, smart pointers, move semantics, templates
  3. System design: Learn to design thread pools, caches, memory allocators, pub-sub systems
  4. Projects: Have 1–2 projects on GitHub (a mini game engine, a database, a TCP server)
  5. Mock interviews: Practice explaining your thought process — C++ interviews are often verbal

What Skills Do Employers Want in C++ Developers?

Top 10 skills from job postings (2025–2026):

  1. Strong C++11/14/17/20 knowledge
  2. Data structures & algorithms
  3. Memory management & debugging (Valgrind, AddressSanitizer)
  4. Multithreading & concurrency
  5. Linux/Unix development environment
  6. Build tools (CMake, Make, Ninja)
  7. Version control (Git)
  8. Unit testing (Google Test, Catch2)
  9. Design patterns (Singleton, Factory, Observer, Strategy)
  10. Domain knowledge (gaming/finance/embedded depending on role)

Can You Learn C++ Without Prior Programming Experience?

Yes, but it's harder. C++ is not the friendliest first language — Python or JavaScript are easier starting points. However, many CS programs teach C++ as the first language (IITs, NITs use C/C++ in first year). If you're disciplined and willing to struggle with pointers and memory for the first 2 months, you can absolutely learn C++ from scratch. Use the examples on this page to practice — they start from Hello World and build up gradually.

What Are the Most Common C++ Interview Questions?

  • What is the difference between new/delete and malloc/free?
  • Explain virtual functions and vtable
  • What are smart pointers? When to use shared_ptr vs unique_ptr?
  • What is RAII? Give an example
  • Explain move semantics and rvalue references
  • What is the diamond problem in multiple inheritance?
  • Difference between stack and heap memory allocation
  • What are templates? Explain template specialization
  • How does std::vector resize internally?
  • Write a thread-safe singleton in C++

Is C++ Demand Growing or Declining?

Growing in specialized domains. While web development moved to JavaScript/Python, C++ demand is increasing in: electric vehicles (autonomous driving), AI inference (TensorRT, ONNX Runtime are C++), gaming (Unreal Engine 5), HFT (latency-critical trading), and edge computing. The TIOBE Index shows C++ consistently in top 3. Companies are hiring more C++ developers for performance-critical workloads as software becomes more latency-sensitive.

Which Industries Use C++ the Most?

IndustryUse CaseExample Companies
GamingGame engines, physics, renderingEpic, EA, Ubisoft
Finance/HFTLow-latency trading, risk enginesCitadel, Tower, DE Shaw
AutomotiveSelf-driving, ADAS, ECU firmwareTesla, Waymo, Bosch
Big TechBrowsers, databases, OSGoogle, Microsoft, Meta
AerospaceFlight systems, simulationBoeing, Lockheed, ISRO
AI/ML InfrastructureInference engines, GPU kernelsNVIDIA, OpenAI, Google

How Difficult Is C++ Really for Beginners?

Honest assessment: C++ is one of the hardest mainstream languages to learn. The difficulty comes from: manual memory management (no garbage collector), undefined behavior (code that compiles but crashes), template syntax (notoriously ugly), and the language having 40+ years of features stacked on top of each other. However, you don't need to learn ALL of C++ — modern C++ (C++17/20) is cleaner, and you can be productive knowing ~30% of the language features. Focus on STL, smart pointers, RAII, and basic templates.

What Common Mistakes Do C++ Beginners Make?

  • Memory leaks: Allocating with new but forgetting delete — use smart pointers instead
  • Dangling pointers: Using a pointer after the memory is freed → undefined behavior
  • Not using STL: Writing custom linked lists when std::vector is faster and safer
  • Passing large objects by value: Always pass by const reference for read-only access
  • Ignoring compiler warnings: Warnings often indicate bugs — treat them as errors (-Wall -Werror)
  • Writing C-style code: Using malloc/printf instead of new/cout, raw arrays instead of vector
  • Not learning debugging tools: GDB, AddressSanitizer, and Valgrind catch 90% of memory bugs

Can You Work Remote With a C++ Job?

Yes — increasingly common post-2020. Game development, finance (quant roles), and Big Tech infrastructure teams offer remote C++ positions. Embedded roles are harder to do remotely (need hardware access), though some companies ship dev kits to remote workers. Remote C++ salaries are often 80–100% of on-site pay at major companies. Platforms like LinkedIn, Indeed, and Turing.com list remote C++ positions globally.

Sources: StackOverflow Developer Survey 2024, TIOBE Index, LinkedIn Job Postings 2024–2025, Glassdoor salary data. Practice C++ with the examples above — each runs directly in your browser.