Tag: beginner
All the articles with the tag "beginner".
-
C++ String Length: size() vs length() vs strlen()
Get the length of a string in C++. Why size() and length() are identical, when to use strlen for char arrays, and the signed-unsigned trap that breaks loops.
-
How to Write to a File in C++ (ofstream Explained)
Write text and numbers to a file in C++ with ofstream. Covers creating files, overwriting vs appending, writing a vector, formatting output and checking for errors.
-
Maximum Value of a double in C++ (DBL_MAX Explained)
The max value of a double in C++ is about 1.8e308. Get it with DBL_MAX or numeric_limits, and learn why min() is not the most negative value.
-
How to Compare Floating-Point Numbers in C++ (Why == Fails)
Why 0.1 + 0.2 != 0.3 in C++, and how to compare doubles correctly with an epsilon tolerance. Includes a reusable almostEqual function and when exact == is fine.