Quantcast
Channel: Comments on: S.4.7 — Structs
Browsing latest articles
Browse All 493 View Live

By: yeokaiwei

Unhandled exception at 0x0082373C in Chapter7FractionStruct.exe: 0xC0000094: Integer division by zero. Errr... I think something weird occured...

View Article



By: nascardriver

You only need to update these 2 lines 12     const Fraction f1{ getFraction() };    const Fraction f2{ getFraction() }; For example 12     const Fraction f1{ 22, 7 };    const Fraction f2{ 1, 1 }; With...

View Article

By: yeokaiwei

Yes, I got the same answer but it's not correct.

View Article

By: nascardriver

Yes, because "You're performing integer division twice in line 25 (Only casting the result (Which is already an integer) of the first division to a `double`)." 12345 // this is an integer...

View Article

By: yeokaiwei

Ah, I finally figured out what you were saying. It works now. It's due to my bracket placement. I did a static_cast<double(numerator)twice to make doubly sure. 1 return...

View Article


By: Alex

I don't understand why in the solution of question #2 you define the variables f1 and f2 of type const. Could you explain why? Here's how a wrote the program:...

View Article

By: nascardriver

Everything that you don't want to modify should be `const`. Very few lessons follow this rule (I don't think this is a learncpp rule yet) at this point. Making everything `const` prevents you from...

View Article

By: bool_wp

Solution for Q.1 12345678910111213141516171819202122232425262728293031323334353637383940 #include<cstdlib>#include<iostream> struct Advertising{    int    allAds;    double...

View Article


By: hi

I like this solution! Very well organized and easy to follow. Why #include <csdtlib>?

View Article


By: bool_wp

Hello and thank you! I'm used <cstdlib> for return EXIT_SUCCESS; instead return 0;(for me 0 as a magic number-does not say anything)

View Article
Browsing latest articles
Browse All 493 View Live




Latest Images