Exceptions handling in cpp, C/C++ Programming

Assignment Help:

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.

 


Related Discussions:- Exceptions handling in cpp

Program to Find the Factorial of a Given Number, Program1: Write a progr...

Program1: Write a program to find the factorial of a given number. The input is user given. Final output is printed out on to the screen. Program2: Write a program to gene

Looping, #questiStarting with a blank solution, write a program to prompt t...

#questiStarting with a blank solution, write a program to prompt the user for an employee number, hourly rate and hours worked. Compute and display the employee number, gross weekl

Sums a sequence of integers, assume that the first integer read with cin sp...

assume that the first integer read with cin specifies the number of values remaining to be entered. that program should read only one value each time cin is executed .a typical inp

What is your reaction to following line of code? , Q-What is your reaction ...

Q-What is your reaction to following line of code?               delete this; A: This is not a good programming Practice. A good programmer will insist that you must absolute

Stack over flow for sun sparc, Please use C or C++ to write your programs. ...

Please use C or C++ to write your programs. Our homework will focus on SUN sparc machines because to exploit x86 stack-overflow is too easy. This is not just a programming assignme

Develop libcurl xml project, Develop libcurl XML project I have a Projec...

Develop libcurl XML project I have a Project using XML with C++. You will use things like LIbcurl etc....and a XML parser to finish the project. Developer must know how to use X

Program''s, why is programming is needed now-a-days.what is the benefit of ...

why is programming is needed now-a-days.what is the benefit of colleges to apply heavy loads on students head.

Bank account system, To implement a back account system for new users

To implement a back account system for new users

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd