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,

Recommended Answers

All 9 Replies

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.

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.

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.

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.

Hmmm, I take back my apology. Look in the damn book!!! :P

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.