Questions

C++ questions

Choose a question page, learn the concept, then test your understanding with a quiz.

Execute a Command and Capture Output in C++ with POSIX popen()

Learn how to run POSIX commands from C++ and capture standard output safely using popen(), fgets(), pclose(), and exit-status checks.

cppprocessposixsystem

Find CPU Cores in C and C++ Across Platforms

Learn how to detect available CPU hardware concurrency in C++ and query logical processors or physical cores on Windows, Linux, and macOS.

cppcmultithreadingmultiplatform

Fix Undefined Reference to vtable in C++

Learn why C++ reports “undefined reference to vtable,” how missing virtual function definitions cause it, and how to diagnose linker errors.

cppgccg++

Fixing 'usr/bin/ld: cannot find -l...' in C++: Understanding Library Linking

Learn why g++ and ld show 'cannot find -l...' and how to fix library search paths, symbolic links, and linker options in C++ builds.

cpplinuxg++

Float vs Double in C++: Precision, Range, and When to Use Each

Learn the difference between float and double in C++, including precision, memory, rounding errors, range, and practical selection rules.

cppcfloating-pointprecision

GCC -fPIC: Position-Independent Code in C

Learn what GCC's -fPIC option does, how position-independent code works, and why shared libraries use it, with practical C examples.

cppgccfpic

Get Assembly Output from C/C++ with GCC

Learn how to generate and inspect assembly output from C and C++ source with GCC using -S, optimization flags, syntax options, and debugging tips.

cppcassemblygcc

Handling Cycles in Family Tree Graphs in C++ and Qt

Learn how to model and process cycles in family tree software using C++ and Qt without breaking assertions or graph logic.

cppgraphcycleassertions

How to Append One std::vector to Another in C++

Learn how to append one std::vector to another in C++ using insert, with examples, pitfalls, and practical patterns for real code.

cppstlstdvector

How to Call a Parent Class Function from a Derived Class in C++

Learn how to call a base class function from a derived class in C++ with clear examples, syntax, common mistakes, and practical usage.

cppoopinheritance

How to Check If a File Exists in Standard C++ (C++11, C++14, C++17)

Learn standard ways to check whether a file exists in C++11, C++14, and C++17, with examples, pitfalls, and practical usage patterns.

cppcfilestream

How to Check If a String Contains Another String in C++

Learn how to check whether a std::string contains another std::string in C++ using find(), comparisons, and beginner-friendly examples.

cppstringsubstring

How to Check Whether a Templated Class Has a Member Function in C++

Learn how to detect whether a class has a member function in C++ templates using SFINAE, detection idioms, and practical examples.

cpptemplatestemplate-meta-programmingsfinae

How to Check if a Key Exists in std::map in C++

Learn how to check whether a key exists in std::map in C++ using find, count, and equal_range, with examples and common mistakes.

cppdictionarystdstdmap

How to Check if an Item Exists in std::vector in C++

Learn how to check whether a value exists in a std::vector in C++ using std::find, with examples, pitfalls, and real-world usage.

cppstdstdvector

How to Clear a std::stringstream in C++

Learn how to reset a C++ std::stringstream correctly by clearing its stored text and error flags, with examples, pitfalls, and practical patterns.

cppstringstream

How to Compare Float and Double Values Safely in C++

Learn how to compare float and double values in C++ using epsilon, relative tolerance, and practical patterns to handle precision loss correctly.

cppalgorithmoptimizationfloating-point

How to Concatenate Two std::vector Objects in C++

Learn how to concatenate two std::vector objects in C++ using insert, loops, and move iterators with clear examples and common pitfalls.

cppconcatenationstdstdvector

How to Concatenate a std::string and an int in C++

Learn how to combine a std::string and an int in C++ using std::to_string, streams, and safe string concatenation patterns.

cppintegerconcatenationstdstring

How to Convert int to String in C++

Learn how to convert int to string in C++ using std::to_string, stringstream, and older approaches with clear examples.

cppstringtype-conversioninteger

Page 3 of 8 - 158 questions