© Will Briggs 2019
Will BriggsC++ for Lazy Programmershttps://doi.org/10.1007/978-1-4842-5187-4_3

3. Numbers

Will Briggs
(1)
Lynchburg, VA, USA
 
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.

Variables

Variables might seem like the letters we use in algebra – y=mx+b, that sort of thing – but in C++, they’re just places to store numbers (among other things). Example 3-1 shows what it looks like when we create variables.
int main (int argc, char** argv)
{
      int    seasonsOfAmericanIdol             = 17;
                              //after a while you lose track
      float  hoursIveWatchedAmericanIdol        = 424.5F;
                              //missed half an episode, ...

Get C++ for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.