C++ Programming Chapter 10(Exception Handling and Templates)

Chapter 10(Exception Handling and Templates)

throw: send a signal that an error has occurred.

try: followed by a block {}, is used to invoke code that throws an exception.

catch: followed by a block {}, is used to detect and process exceptions thrown in preceding try block.  Takes a parameter that matches the type thrown.


*masuk try block punya line,panggil function totalDays( )
*kalau 1st parameter between 0 dan 7,total num of days akan return and skip catch block.
*kalau selain tu(exception) try block akan panggil function exit( )
  catch akan discan pastu run yang catch tu

This program intended to perform array manipulation consisting of adding and removing elements to/from array.A class named Array has been defined in the program for this purpose.The array specified such that it can only hold up to three elements.The elements are stored in data,whereas the number of elements are currently held by the array is kept in the attributes count.When an element needs to provide a bound error checking whereby elements cannot be added anymore,when the array is full.Similarly ,removing an element cannot accomplish if the array is empty.Also,accessing an element is allowable only if a valid index is used.

Complete the program according task 1 to 9.


Post a Comment

0 Comments