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
What is conversion operator? Explain it with example.

create a program to populate the first array then the odd number is the second array and get the sum of the second array.

c program to count the number of occurances of the string in padovan''s string

Write a simple generic version of method isEqualTo that compares its two arguments with the equals method and returns true if they are equal and false otherwise. Use this generic m

Project Description: Currently seeking someone who can create me a software application (google chrome crx file_ that will auto add all shoe sizes to cart directly and if not av

//Create a custom calculator program capable of reading the input stream of an expression //and make basic computations to provide answer. //Your program will ask the user to

Write a program to sort an array of strings. Use new and delete operators. Write a program to find the factorial of a number using recursion. If we do not accept the number

Derived Data Type: Array is derived data type to store large collection of data of only one data type. int mark[100]; char names[25]; Function: will be discussed early

Classify computer system according to capacity. How they are different from computers according to the classification of technology. Provide comparative study also.

A:BinaryHeap.h ------------ #ifndef BINARY_HEAP_H_ #define BINARY_HEAP_H_ #include "dsexceptions.h" #include "vector.h" // BinaryHeap class // CONSTRUCTION: wi