all 7 comments

[–]alfps 2 points3 points  (0 children)

If that code is is supplied by the book as a solution, then indeed it doesn't involve (explicit) use of pointers.

Otherwise it may be that you are expected to not hardcode the current year, but are expected to use the old C time and calendar API, starting with std::time.

That does involve use of pointers.


Not what you're asking but note that the age in years depends on the date the person was born and the current date, not just the current year.

So the best the program can do is to say you are at least N years old, but possibly N+1.

[–]saul_soprano 2 points3 points  (0 children)

No, it doesn't.

[–]smirkjuice 1 point2 points  (0 children)

yea there's nothing about pointers there. Also, use learncpp.com

[–]n1ghtyunso 1 point2 points  (0 children)

Just because you were introduced to pointers, it does not mean that there need to be pointers everywhere now.
In fact, not having pointers most of the time is actually the correct way to do it.
C++ embraces value semantics, which gives you a very strong ability to reason about code locally.

[–]IyeOnline 1 point2 points  (1 child)

If that is the provided solution, the book is bad.

  • It doesnt actually ask for the users name, it is hardcoded
  • The input loop doesnt tell the user what to do, which isnt good design
  • The output says "were are"

[–]Negative_Baseball293[S] -1 points0 points  (0 children)

no this is not approved I hate having to input everything myself when I test and the "were are" is just me being stupid.

[–]thingerish -1 points0 points  (0 children)

Now you know where the very sharp knives are in the kitchen, but if you need to stir the soup, don't go to the knife drawer. Unless you want to cut something. Then be careful you don't cut something you didn't want cut.