C++ programming Exercises practice with solution
What is C++ Programming Language?
C++ is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation.
It was designed with a bias toward system programming and embedded, resource-constrained and large systems, with performance, efficiency and flexibility of use as its design highlights. Many vendors provide C++ compilers, including the Free Software Foundation, Microsoft, Intel, and IBM.
The best way we learn anything is by practice and exercise questions. We have started this section for those (beginner to intermediate) who are familiar with C++ programming.
Hope, these exercises help you to improve your C++ programming coding skills. Currently, following sections are available, we are working hard to add more exercises .... Happy Coding!
List of C++ Exercises
- Basic Exercises: 86 Exercises with Solution
- Basic Algorithm Exercises: 117 Exercises with Solution
- For Loop Exercises: 87 Exercises with Solution
- Date Exercises: 6 Exercises with Solution
- String Exercises: 42 Exercises with Solution
- Array Exercises: 30 Exercises with Solution
- Vector Exercises: 6 Exercises with Solution
- Math Exercises: 35 Exercises with Solution
- Linked List Exercises: 21 Exercises with Solution
- Numbers: 46 Exercises with Solution
- Sorting and Searching: 14 Exercises with Solution
- More ....
More to Come !
Popularity of Programming Language Worldwide, Nov 2022 compared to a year ago:
|1||Python||28.44 %||-1.2 %|
|5||C/C++||6.51 %||-0.4 %|
|6||PHP||5.12 %||-1.0 %|
|16||VBA||0.97 %||-0.2 %|
|17||Ada||0.81 %||-0.0 %|
|18||Dart||0.76 %||+0.3 %|
|19||Scala||0.73 %||-0.0 %|
|20||Lua||0.64 %||+0.2 %|
|21||Visual Basic||0.62 %||-0.1 %|
|22||Abap||0.48 %||-0.0 %|
|23||Perl||0.38 %||+0.0 %|
|24||Groovy||0.37 %||+0.0 %|
|25||Julia||0.3 %||+0.0 %|
|26||Haskell||0.29 %||+0.0 %|
|27||Cobol||0.28 %||-0.1 %|
|28||Delphi/Pascal||0.12 %||-0.1 %|
Source : https://pypl.github.io/PYPL.html
TIOBE Index for November 2022
|Nov 2022||Nov 2021||Change||Programming Language||Ratings||Change|
|13||11||Classic Visual Basic||1.10%||-0.46%|
Source : https://www.tiobe.com/tiobe-index/
C++ Programming: Tips of the Day
How do you clear a stringstream variable?
For all the standard library types the member function empty() is a query, not a command, i.e. it means "are you empty?" not "please throw away your contents".
The clear() member function is inherited from ios and is used to clear the error state of the stream, e.g. if a file stream has the error state set to eofbit (end-of-file), then calling clear() will set the error state back to goodbit (no error).
For clearing the contents of a stringstream, using:
is correct, although using:
is technically more efficient, because you avoid invoking the std::string constructor that takes const char*. But any compiler these days should be able to generate the same code in both cases - so I would just go with whatever is more readable.
- Exercises: Weekly Top 16 Most Popular Topics
- SQL Exercises, Practice, Solution - JOINS
- SQL Exercises, Practice, Solution - SUBQUERIES
- Java Array: Exercises, Practice, Solution
- C Programming Exercises, Practice, Solution : Conditional Statement
- HR Database - SORT FILTER: Exercises, Practice, Solution
- C Programming Exercises, Practice, Solution : String
- Python Data Types: Dictionary - Exercises, Practice, Solution
- Python Programming Puzzles - Exercises, Practice, Solution
- C++ Array: Exercises, Practice, Solution
- C# Sharp Basic Algorithm: Exercises, Practice, Solution
- Python Lambda - Exercises, Practice, Solution
- Python Pandas DataFrame: Exercises, Practice, Solution
- Conversion Tools