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
implementation of the power and factorial in programs

Question: (a) Explain a linked list. (b) Describe the three different types of linked list with the help of diagrams. (c) Give two advantages and two disadvantages

Define register with bit fields? We could define register simply with bit fields: struct DISK_REGISTER { unsigned ready:1; unsigned error_occured:1; unsigned disk_spinni

to calculate the amount to be paid by a customer buying yummy cupcakes for his birth day party

algorithm to prepare mark sheet of a student by inputing name,branchcode,semester,register no,5 marks of students and total mark of student


program coding for the conversion of string to a palindrome

For this program you will add and test 2 new member functions to the IntSLList class posted on the website. The two member functions are: insertByPosn(int el, int pos) Assuming t

Program to show the ascii value of characters: int main() {                 int one_char;                 cout                 one_char = getch();

Implement the search property from catalogue menu option.  After selecting this option the user should be asked to specify the property using the following sub-menu: 1. Specif