Abstract
Numbers are what makes the computer's world go 'round, so let's examine ways to get the computer to handle those numbers for us.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
I’m lining up the =’s, you’ll notice. Neatness makes for easier reading.
- 2.
There are maybe too many ways to declare constant values in C++: const, enum, constexpr, inline constexpr, static const...but we’ll get to that later.
- 3.
If you want to add 1, rather than some other number, there’s a special “increment” operator just for that:
++seasonsOfAmericanIdol;
We’ll see that again in Chapter 5, along with “decrement” (--).
- 4.
Include files inherited from C++’s ancestor C, under current conventions, start with a “c”: cmath and cstdlib, for example.
- 5.
We cast to int to avoid that conversion warning mentioned in the preceding “Antibugging.” The time function returns a time_t (whatever that is); we’ll force it to be an int.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Will Briggs
About this chapter
Cite this chapter
Briggs, W. (2019). Numbers. In: C++ for Lazy Programmers. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5187-4_3
Download citation
DOI: https://doi.org/10.1007/978-1-4842-5187-4_3
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-5186-7
Online ISBN: 978-1-4842-5187-4
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books