# C++

**URL:** https://forum.codewithmosh.com/c/cpp/25.md

[Latest](https://forum.codewithmosh.com/latest.md) · [Categories](https://forum.codewithmosh.com/categories.md)

---

## [About the C++ category](https://forum.codewithmosh.com/t/about-the-c-category/14543)

<div class="topic-metadata">

**Author:** [@Mosh](https://forum.codewithmosh.com/u/Mosh)\
**Replies:** 0

</div>

---

## [Will there be another C++ course discount](https://forum.codewithmosh.com/t/will-there-be-another-c-course-discount/72389)

<div class="topic-metadata">

**Author:** [@GatisT](https://forum.codewithmosh.com/u/GatisT)\
**Replies:** 0\
**Last updated:** [March 23, 2026, 1:27pm UTC](https://forum.codewithmosh.com/t/will-there-be-another-c-course-discount/72389 "2026-03-23T13:27:21Z")

</div>

Hi! I missed the discount . Will there b e another one in near future?

---

## [Confusion about random number generator tutorial](https://forum.codewithmosh.com/t/confusion-about-random-number-generator-tutorial/72238)

<div class="topic-metadata">

**Author:** [@mapf](https://forum.codewithmosh.com/u/mapf)\
**Replies:** 1\
**Last updated:** [February 9, 2026, 6:17pm UTC](https://forum.codewithmosh.com/t/confusion-about-random-number-generator-tutorial/72238 "2026-02-09T18:17:36Z")

</div>

In the tutorial about random number generation (Fundamental Data Types - 6), the solution for the dice roll is to execute the rand()function twice like so: #include \<iostream\> #include \<cstdlib\> #include \<ctime\> using …

---

## [When is your "Mastering the C++ STL" course coming out?"](https://forum.codewithmosh.com/t/when-is-your-mastering-the-c-stl-course-coming-out/19057)

<div class="topic-metadata">

**Author:** [@agajansahatov](https://forum.codewithmosh.com/u/agajansahatov)\
**Replies:** 1\
**Last updated:** [January 20, 2026, 2:24am UTC](https://forum.codewithmosh.com/t/when-is-your-mastering-the-c-stl-course-coming-out/19057 "2026-01-20T02:24:18Z")

</div>

Hi Mosh! I have finished “The Ultimate C++ Series” course of yours. In the end of the the 3rd part of these series, you said that you’ve got a course called “Mastering the C++ STL”. So, when are you planning to create th…

---

## [C++ Fundamentals / Organazing functions in files issue](https://forum.codewithmosh.com/t/c-fundamentals-organazing-functions-in-files-issue/72014)

<div class="topic-metadata">

**Author:** [@Sitrixs](https://forum.codewithmosh.com/u/Sitrixs)\
**Replies:** 2\
**Last updated:** [December 30, 2025, 9:43pm UTC](https://forum.codewithmosh.com/t/c-fundamentals-organazing-functions-in-files-issue/72014 "2025-12-30T21:43:54Z")

</div>

Hello folks, I am running into a bit of an issue with the tutorial. This is the error I am getting. c++ /home/sitrixs/Clion/ClionProjects/HelloWorld/main.cpp -o main /usr/bin/ld: /tmp/ccmfqRb9.o: in function main': m…

---

## [ApplicationExercices](https://forum.codewithmosh.com/t/applicationexercices/71766)

<div class="topic-metadata">

**Author:** [@Mona](https://forum.codewithmosh.com/u/Mona)\
**Replies:** 1\
**Last updated:** [November 24, 2025, 11:08am UTC](https://forum.codewithmosh.com/t/applicationexercices/71766 "2025-11-24T11:08:31Z")

</div>

in the c++ course are the practice exercises available only in the basics part ?

---

## [Is everything in c++ basics course included in the youtube video?](https://forum.codewithmosh.com/t/is-everything-in-c-basics-course-included-in-the-youtube-video/22384)

<div class="topic-metadata">

**Author:** [@Nikola](https://forum.codewithmosh.com/u/Nikola)\
**Replies:** 3\
**Last updated:** [November 8, 2025, 12:06pm UTC](https://forum.codewithmosh.com/t/is-everything-in-c-basics-course-included-in-the-youtube-video/22384 "2025-11-08T12:06:49Z")

</div>

I want to learn c++. I watched c++ basics course on youtube. I understand everything from there. Do I need the basics course here or is it the same?

---

## [I want to practice C++](https://forum.codewithmosh.com/t/i-want-to-practice-c/26429)

<div class="topic-metadata">

**Author:** [@nh0xbno1](https://forum.codewithmosh.com/u/nh0xbno1)\
**Replies:** 2\
**Last updated:** [November 7, 2025, 10:33am UTC](https://forum.codewithmosh.com/t/i-want-to-practice-c/26429 "2025-11-07T10:33:18Z")

</div>

Does any know the website to practice C++? I just study part 1 and want to practice more about that .

---

## [String values are not getting compiled properly](https://forum.codewithmosh.com/t/string-values-are-not-getting-compiled-properly/71161)

<div class="topic-metadata">

**Author:** [@Subho2024](https://forum.codewithmosh.com/u/Subho2024)\
**Replies:** 0\
**Last updated:** [March 20, 2025, 6:21pm UTC](https://forum.codewithmosh.com/t/string-values-are-not-getting-compiled-properly/71161 "2025-03-20T18:21:01Z")

</div>

After running the code the street, city, state and zipcode values are not getting compiled.

---

## [Stream insertion operator of a class template C++ Part3](https://forum.codewithmosh.com/t/stream-insertion-operator-of-a-class-template-c-part3/29749)

<div class="topic-metadata">

**Author:** [@BEC](https://forum.codewithmosh.com/u/BEC)\
**Replies:** 3\
**Last updated:** [November 4, 2024, 10:58pm UTC](https://forum.codewithmosh.com/t/stream-insertion-operator-of-a-class-template-c-part3/29749 "2024-11-04T22:58:45Z")

</div>

How can I overload the stream insertion operator of a pair class template? Tried using friends of classes but didn’t work also tried the below method but didn’t work also Can someone help me out? Thanks in advance

---

## [I want to integrate 2 simple code given below to make single workable code, the new code be like when we enter 2 different values in terminal then we get larger integer, thank you](https://forum.codewithmosh.com/t/i-want-to-integrate-2-simple-code-given-below-to-make-single-workable-code-the-new-code-be-like-when-we-enter-2-different-values-in-terminal-then-we-get-larger-integer-thank-you/26759)

<div class="topic-metadata">

**Author:** [@deepeshsuthar](https://forum.codewithmosh.com/u/deepeshsuthar)\
**Replies:** 4\
**Last updated:** [November 3, 2024, 4:27am UTC](https://forum.codewithmosh.com/t/i-want-to-integrate-2-simple-code-given-below-to-make-single-workable-code-the-new-code-be-like-when-we-enter-2-different-values-in-terminal-then-we-get-larger-integer-thank-you/26759 "2024-11-03T04:27:48Z")

</div>

1st Code : #include using namespace std; int max(int first, int second){ return(first\>second) ? first: second; } int main(){ int larger=max(1,2) ; cout\<\<larger; return 0; } 2nd code: #include using namespa…

---

## [Getting a Build failed Error in Clion](https://forum.codewithmosh.com/t/getting-a-build-failed-error-in-clion/29455)

<div class="topic-metadata">

**Author:** [@Subho2024](https://forum.codewithmosh.com/u/Subho2024)\
**Replies:** 2\
**Last updated:** [October 26, 2024, 10:41am UTC](https://forum.codewithmosh.com/t/getting-a-build-failed-error-in-clion/29455 "2024-10-26T10:41:21Z")

</div>

I am facing an issue in Clion while going through the C++ tutorial - Ultimate C++ Part 1: Fundamentals. In the chapter “Generating Random Number” after compiling, I am getting am error “Build Failed” while I am executing…

---

## [C++ Group Beginner/Intermediate](https://forum.codewithmosh.com/t/c-group-beginner-intermediate/15168)

<div class="topic-metadata">

**Author:** [@livetogain](https://forum.codewithmosh.com/u/livetogain)\
**Replies:** 3\
**Last updated:** [October 13, 2024, 11:52am UTC](https://forum.codewithmosh.com/t/c-group-beginner-intermediate/15168 "2024-10-13T11:52:46Z")

</div>

Hi all! I’m getting back into programing to finish my degree that I started several years ago. I’m re-learning everything, so if anyone wants to do some fun projects together, lemme know! We can tackle the same projects…

---

## [I have an error, though I'm doing it like at lesson](https://forum.codewithmosh.com/t/i-have-an-error-though-im-doing-it-like-at-lesson/29054)

<div class="topic-metadata">

**Author:** [@Mark](https://forum.codewithmosh.com/u/Mark)\
**Replies:** 2\
**Last updated:** [October 2, 2024, 7:26pm UTC](https://forum.codewithmosh.com/t/i-have-an-error-though-im-doing-it-like-at-lesson/29054 "2024-10-02T19:26:32Z")

</div>

How can I fix this, is it because I’m not using clion?

---

## [Errors with creating header files](https://forum.codewithmosh.com/t/errors-with-creating-header-files/21098)

<div class="topic-metadata">

**Author:** [@qwertyuiop](https://forum.codewithmosh.com/u/qwertyuiop)\
**Replies:** 15\
**Last updated:** [September 29, 2024, 12:07pm UTC](https://forum.codewithmosh.com/t/errors-with-creating-header-files/21098 "2024-09-29T12:07:20Z")

</div>

In part 3 of the C++ course in the creating objects video, I’m having trouble with creating the class in visual studio code. main.cpp: #include “rectangle.hpp” #include using namespace std; int main() { rectangle …

---

## [Numeric\_limits class "not declared error](https://forum.codewithmosh.com/t/numeric-limits-class-not-declared-error/28970)

<div class="topic-metadata">

**Author:** [@Goldwing\_Pat](https://forum.codewithmosh.com/u/Goldwing_Pat)\
**Replies:** 1\
**Last updated:** [September 28, 2024, 4:06pm UTC](https://forum.codewithmosh.com/t/numeric-limits-class-not-declared-error/28970 "2024-09-28T16:06:21Z")

</div>

Hi there, Brand new to C++ and basic experience in programming in C. I use Codeblocks with GCC compiler. I am trying to use the "numeric\_limits"class as explained in tutorial but I get an error when compiling. ‘numer…

---

## [Engineering vs coding](https://forum.codewithmosh.com/t/engineering-vs-coding/21481)

<div class="topic-metadata">

**Author:** [@Philhoy76](https://forum.codewithmosh.com/u/Philhoy76)\
**Replies:** 14\
**Last updated:** [August 12, 2023, 9:11am UTC](https://forum.codewithmosh.com/t/engineering-vs-coding/21481 "2023-08-12T09:11:31Z")

</div>

I am a trader getting into the algorithmic side of it all. And looking for more engineering resources. I have a decent grasp on coding logic to syntax in C++ but how do you get information from one spot to another. I kno…

---

## [Searching arrays](https://forum.codewithmosh.com/t/searching-arrays/28399)

<div class="topic-metadata">

**Author:** [@donmoy](https://forum.codewithmosh.com/u/donmoy)\
**Replies:** 2\
**Last updated:** [August 27, 2024, 5:13pm UTC](https://forum.codewithmosh.com/t/searching-arrays/28399 "2024-08-27T17:13:08Z")

</div>

Hi everyone, can someone explain why we put (return i) instead of (return target).

---

## [Unpacking Arrays](https://forum.codewithmosh.com/t/unpacking-arrays/28342)

<div class="topic-metadata">

**Author:** [@donmoy](https://forum.codewithmosh.com/u/donmoy)\
**Replies:** 7\
**Last updated:** [August 24, 2024, 6:10pm UTC](https://forum.codewithmosh.com/t/unpacking-arrays/28342 "2024-08-24T18:10:04Z")

</div>

It says my variable x is undefined please help

---

## [Ultimate C++ Understanding size\_t](https://forum.codewithmosh.com/t/ultimate-c-understanding-size-t/28280)

<div class="topic-metadata">

**Author:** [@Zatharis](https://forum.codewithmosh.com/u/Zatharis)\
**Replies:** 2\
**Last updated:** [August 19, 2024, 11:38pm UTC](https://forum.codewithmosh.com/t/ultimate-c-understanding-size-t/28280 "2024-08-19T23:38:26Z")

</div>

This is more a question of curiosity, since these lessons appear to maybe be a little outdated. but what do I do to make this work? it says all my numeric\_limits are incomplete. My follow along:

---

## [Need more help on Loops](https://forum.codewithmosh.com/t/need-more-help-on-loops/28263)

<div class="topic-metadata">

**Author:** [@donmoy](https://forum.codewithmosh.com/u/donmoy)\
**Replies:** 0\
**Last updated:** [August 15, 2024, 10:42pm UTC](https://forum.codewithmosh.com/t/need-more-help-on-loops/28263 "2024-08-15T22:42:29Z")

</div>

I need more help on loops, can anyone give more pratice on it.

---

## [Fibonacci Numbers in C++](https://forum.codewithmosh.com/t/fibonacci-numbers-in-c/27495)

<div class="topic-metadata">

**Author:** [@deepeshsuthar](https://forum.codewithmosh.com/u/deepeshsuthar)\
**Replies:** 1\
**Last updated:** [August 13, 2024, 1:57pm UTC](https://forum.codewithmosh.com/t/fibonacci-numbers-in-c/27495 "2024-08-13T13:57:30Z")

</div>

Anybody can code Fibonacci numbers in C++ for me.

---

## ["using namespace" in header files is bad practice](https://forum.codewithmosh.com/t/using-namespace-in-header-files-is-bad-practice/27250)

<div class="topic-metadata">

**Author:** [@brokkolibri](https://forum.codewithmosh.com/u/brokkolibri)\
**Replies:** 1\
**Last updated:** [August 13, 2024, 1:55pm UTC](https://forum.codewithmosh.com/t/using-namespace-in-header-files-is-bad-practice/27250 "2024-08-13T13:55:15Z")

</div>

I’m really baffled that this used and thus shown as (presumably) good practice in so many of the C++ course videos. For instance in Ultimate C++ Part 3: Advanced - 5- Overloading the stream insertion operator: This i…

---

## [Need help in C++ logic](https://forum.codewithmosh.com/t/need-help-in-c-logic/27468)

<div class="topic-metadata">

**Author:** [@udayprakash2005](https://forum.codewithmosh.com/u/udayprakash2005)\
**Replies:** 1\
**Last updated:** [August 13, 2024, 1:44pm UTC](https://forum.codewithmosh.com/t/need-help-in-c-logic/27468 "2024-08-13T13:44:36Z")

</div>

Please explain the logic used here. the images are in the link here:

---

## [Issue with multiplication in C++](https://forum.codewithmosh.com/t/issue-with-multiplication-in-c/27663)

<div class="topic-metadata">

**Author:** [@Alawson](https://forum.codewithmosh.com/u/Alawson)\
**Replies:** 1\
**Last updated:** [July 14, 2024, 9:14pm UTC](https://forum.codewithmosh.com/t/issue-with-multiplication-in-c/27663 "2024-07-14T21:14:13Z")

</div>

Hi guys, I am doing the “If Statements” lesson in the C++ course and having trouble with the commission calculator project. The issue is that when I multiply two variables together it always results in 0. Here is my co…

---

## [Sorting Arrays Bubble](https://forum.codewithmosh.com/t/sorting-arrays-bubble/27337)

<div class="topic-metadata">

**Author:** [@connor](https://forum.codewithmosh.com/u/connor)\
**Replies:** 2\
**Last updated:** [June 25, 2024, 8:55pm UTC](https://forum.codewithmosh.com/t/sorting-arrays-bubble/27337 "2024-06-25T20:55:24Z")

</div>

General question about this code because I’m trying to fully understand what’s going on. Question at bottom… void swap(int numbers, int i, int j) { int temp = numbers\[i\]; numbers\[i\] = numbers\[j\]; numbers\[j\] = temp; …

---

## [Mastering c++ stl](https://forum.codewithmosh.com/t/mastering-c-stl/15265)

<div class="topic-metadata">

**Author:** [@kartik](https://forum.codewithmosh.com/u/kartik)\
**Replies:** 3\
**Last updated:** [June 20, 2024, 5:04pm UTC](https://forum.codewithmosh.com/t/mastering-c-stl/15265 "2024-06-20T17:04:35Z")

</div>

When can we expect this course.?

---

## [Size() not working](https://forum.codewithmosh.com/t/size-not-working/15564)

<div class="topic-metadata">

**Author:** [@Helmut](https://forum.codewithmosh.com/u/Helmut)\
**Replies:** 8\
**Last updated:** [June 20, 2024, 1:21pm UTC](https://forum.codewithmosh.com/t/size-not-working/15564 "2024-06-20T13:21:11Z")

</div>

In the intermediate lesson “3- Determining the Size of Arrays” Mosh introduces the size() function to determine the size of an array. However, it doesn’t work on my system (macOS, CLion, C++20). Does anybody else have t…

---

## [Using std::size](https://forum.codewithmosh.com/t/using-std-size/25943)

<div class="topic-metadata">

**Author:** [@POMPOMBALLS](https://forum.codewithmosh.com/u/POMPOMBALLS)\
**Replies:** 1\
**Last updated:** [June 19, 2024, 6:04am UTC](https://forum.codewithmosh.com/t/using-std-size/25943 "2024-06-19T06:04:38Z")

</div>

I have found that many still have issue using std::size() general template function. As mentioned on C++ reference, std::size was implemented in C++17. Now, the difference comes with the compiler used when using the sa…

---

## [C++ course suscribing](https://forum.codewithmosh.com/t/c-course-suscribing/26047)

<div class="topic-metadata">

**Author:** [@bradinho](https://forum.codewithmosh.com/u/bradinho)\
**Replies:** 1\
**Last updated:** [June 18, 2024, 6:24pm UTC](https://forum.codewithmosh.com/t/c-course-suscribing/26047 "2024-06-18T18:24:51Z")

</div>

I am interested in the c++ course, but I don’t understand the difference between subscribing for a month or purchasing the course directly, and also why these 2 options are worth the same. Can someone explain it to me?

[Next page](https://forum.codewithmosh.com/c/cpp/25.md?page=1)
