About 11,200,000 results
Open links in new tab
  1. What is the <=> ("spaceship", three-way comparison) operator in …

    Nov 24, 2017 · This is called the three-way comparison operator. According to the P0515 paper proposal: There’s a new three-way comparison operator, <=>. The expression a <=> b returns …

  2. What is the purpose of using #ifdef and #if in C++?

    The meaning of #ifdef is that the code inside the block will be included in the compilation only if the mentioned preprocessor macro is defined. Similarly, #if means that the block will be …

  3. How to use the PI constant in C++ - Stack Overflow

    Nov 13, 2009 · I want to use the PI constant and trigonometric functions in some C++ program. I get the trigonometric functions with include &lt;math.h&gt;. However, there doesn't seem to be …

  4. How to generate a random number in C++? - Stack Overflow

    Nov 19, 2012 · I'm trying to make a game with dice, and I need to have random numbers in it (to simulate the sides of the die. I know how to make it between 1 and 6). Using #include …

  5. Regular cast vs. static_cast vs. dynamic_cast - Stack Overflow

    Aug 26, 2008 · I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e. …

  6. What does the C++ standard say about the size of int, long?

    I'm looking for detailed information regarding the size of basic C++ types. I know that it depends on the architecture (16 bits, 32 bits, 64 bits) and the compiler. But are there any standards for ...

  7. Why are #ifndef and #define used in C++ header files?

    I have been seeing code like this usually in the start of header files: #ifndef HEADERFILE_H #define HEADERFILE_H And at the end of the file is #endif What is the purpose of this?

  8. Iterate through a C++ Vector using a 'for' loop - Stack Overflow

    Oct 3, 2012 · I am new to the C++ language. I have been starting to use vectors, and have noticed that in all of the code I see to iterate though a vector via indices, the first parameter of …

  9. C++ code file extension? What is the difference between .cc and …

    95 .cpp is the recommended extension for C++ as far as I know. Some people even recommend using .hpp for C++ headers, just to differentiate from C. Although the compiler doesn't care …

  10. What's the difference between constexpr and const?

    What's the difference between constexpr and const? When can I use only one of them? When can I use both and how should I choose one?