Exceptions handling in cpp, C/C++ Programming

Exceptions. Your SVector class should throw four exceptions: 3.1. If the constructor size is invalid, then it will just allow the implicit STL bad_alloc exception to pass up to main().

3.2. If the string index is invalid, then it should explicitly throw an STL range_error exception.

3.3. If the SVector is empty when a pop_back is called because the vector is empty, then it should throw an underflow exception of the STL.

3.4. If the string used for push_back is a duplicate then your class will throw an exception of a class named Whoops that you write in SVector.h that has a constructor, and a what() method.

3.5. Your function definitions should indicate what type of exception they throw.

3.6. You can find information about the STL exceptions at:

3.7. assert 3.7.1.You must add assertions that would catch the three explicit SVector exceptions of 3.2, 3.3, and 3.4 before they reach the throw statements.

3.8. Makefile 3.8.1.Your Makefile should have a "all:" rule that compiles both p8.out with the NDEBUG defined using the D option of g++, and p8b.out that compiles without NDEBUG defined so that the asserts will work.

3.8.2.You need not compile a mainB.o file for this assignment, so only two lines are needed to create each executable.

 

Posted Date: 3/6/2013 2:51:52 AM | Location : United States







Related Discussions:- Exceptions handling in cpp, Assignment Help, Ask Question on Exceptions handling in cpp, Get Answer, Expert's Help, Exceptions handling in cpp Discussions

Write discussion on Exceptions handling in cpp
Your posts are moderated
Related Questions
A: Use operator overloading to present a friend right-shift operator, operator>>. It is similar to the output operator, except the parameter doesn't contain a const: "Fred&" instea

I Want a answer for solving the big M method in the topic of simplex method...

what is virtual datatype

draw the flow chart to print the fibonacci series upto n th terms

#questi An array of n numbers is given, where n is an even number. The maximum as well as minimum of these given numbers need to be determined. Which of the following is true about

(a) Write a recursive procedure (digits n) that computes the number of digits in the integer n using a linear recursive process. For example, (digits 42) should return 2 and (digit

Inline functions, C++ provides inline functions to help reduce function_call overhead especially for small functions. The qualifier inline before function's return type in the f

What does this mean that "friendship isn't transitive, inherited or reciprocal"? A: As I grant you friendship access to me doesn't grant your kids automatically access to me, do

smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

- But with less features and more user-friendly (particularly for non-tech savvy users). - Software needed having a left menu with links (no pictures required) for every hardwar