Questions

C++ questions

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

Copy-and-Swap Idiom in C++: What It Is, Why It Matters, and When to Use It

Learn the copy-and-swap idiom in C++, how assignment works, what problems it solves, and how C++11 move semantics affect it.

cppcopy-constructorassignment-operatorc++-faq

Dependent Names, typename, and template in C++ Templates

Learn when and why to use typename and template with dependent names in C++ templates, with clear examples and common pitfalls.

cpptemplatestypenamec++-faq

Difference Between `struct Foo` and `typedef struct` in C++

Learn the difference between `struct Foo {}` and `typedef struct {}` in C++, including naming, typedef behavior, and modern best practices.

cppstructtypedef

Difference Between gcc and g++ for C++ Development

Learn the difference between gcc and g++, how they compile C and C++ code, and which compiler command to use for general C++ development.

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++

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 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

How to Convert std::string to Lowercase in C++

Learn how to safely convert std::string to lowercase in C++ using std::tolower, loops, and transform, with pitfalls and examples.

cppstringstdtolower

How to Convert std::string to const char* or char* in C++

Learn how to convert std::string to const char* or char* in C++, when to use c_str() or data(), and how to avoid common mistakes.

cppstringcharstdstring

How to Convert std::string to int in C++

Learn how to convert std::string to int in C++ using stoi, stringstream, and older functions, with examples, pitfalls, and best practices.

cppstringinteger

Page 2 of 6 - 110 questions