0

Hi all,

I am learning to code in c++ on Linux Mint 13. I am going through an exercise drill in a book called "Programming Principles and Practice using c++ by Bjarne Strustrup". I have a couple of questions.

  • I am having trouble with the calling the error function mentioned below.

Have your program write "I hear you just had a birthday and you are age years old." If age is 0 or less or 110 or more, call error("you're kidding!").

(It is Drill no5. on pg83 if anyone has access to the book)

  • Also, I think Bjarne is using a Windows machine to do these exercises.

Ones I've encountered sofar:

keep_window_open()

Does this mean that I have to find alternative functions to the ones mentioned in the book? and is there any website where I can find alternative funtions for windows ones (on a beginners level?)

thanks in advance,

Edited by mferarri: better readability

5
Contributors
9
Replies
11
Views
4 Years
Discussion Span
Last Post by mferarri
0

Does this mean that I have to find alternative functions to the ones mentioned in the book?

No. You need to read closer. You should find that he provided code for these functons.

0

No. You need to read closer. You should find that he provided code for these functons.

What do you mean I need to read closer? I am reading the book from front to back. If you know where Bjarne has explained this, then say so, because I can't see it.

0

OK, sorry. Ignore my previous post. I shall restate:

No, there are no functions called error() and keep_window_open(). They must be something he wrote for the book.

0

For keep_window_open(), check out page 53.

For error(), check out page 140.

As vijayan121 suggests, these are provided in std_lib_facilities.h which can be downloaded from the related site.

0

What do you mean I need to read closer? I am reading the book from front to back. If you know where Bjarne has explained this, then say so, because I can't see it.

In fairness, it's a weakness of the book that error() isn't explained at the point of first use, but several chapters later.

0

Thanks np complete, vijayan121 and Bob. The functions were actually called from the header. The reason why I did not include the header previously is bacause I am not using Microsoft's visual studio. I initially tried to use "std_lib_facilities.h" from his website but my compiler gives me this message:

This file includes at least one deprecated or antiquated header which \
may be removed without further notice at a future date. Please use a \
non-deprecated interface with equivalent functionality instead. For a \
listing of replacement headers and interfaces, consult the file \
backward_warning.h. To disable this warning use -Wno-deprecated.

OK, I see why I couldn't call the functions now. Thanks to everyone that gave me CONSTRUCTIVE feedback.

Edited by mferarri: more info

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.