CSC 330 Object-Oriented Programming. Exception Handling CSC 330

Size: px
Start display at page:

Download "CSC 330 Object-Oriented Programming. Exception Handling CSC 330"

Transcription

1 Object-Oriented Programming Exception Handling 1

2 C++ Exception Handling Topics Exception Handling C++ Exception Handling Basics Throwing and Catching Exceptions Constructors, Destructors and Exceptions 2

3 An Exception is An unusual, often unpredictable event, detectable by software or hardware, that requires special processing; also, in C++, a variable or class object that represents an exceptional event. An exception handler is a section of program code that is executed when a particular exception occurs. 3

4 Assertions 4

5 Program Segment Example 5

6 When to use assert Catching the program logic errors. Use assertion statements to catch logic errors. You can set an assertion on a condition that must be true according to your program logic. The assertion only has an effect if a logic error occurs. Checking the results of an operation. Use assertion statements to check the result of an operation. Assertions are most valuable for testing operations which results are not so obvious from a quick visual inspection. Testing the error conditions that supposed to be handled. Use assertions to test for error conditions at a point in your code where errors supposed to be handled. 6

7 Exception Handling Basics Exception handling is for situations where the function that detects the error cannot deal with it Such a function will throw an exception, and hope there is an exception handler to catch it There is no guarantee that the exception will be caught If it s not caught the program terminates 7

8 ...Exception Handling Basics Exceptions are thrown and caught using try and catch blocks try {... catch {... Code in the try block can throw an exception The catch blocks contains handlers for the various exceptions When an exception is thrown in the try block, the catch blocks are searched for an appropriate exception handler 8

9 Syntax The try-block: try {compound-statement handler-list handler-list here The throw-expression: throw expression { The handler: catch (exception-declaration) compound-statement exception-declaration: type-specifier-list here 9

10 Exception-Handling Overview Throw point Location in try block where exception occurred If exception handled» Program skips remainder of try block» Resumes after catch blocks If not handled» Function terminates» Looks for enclosing catch block If no exception Program skips catch blocks 10

11 Execution of try-catch A statement throws an exception No statements throw an exception Control moves directly to exception handler Exception Handler Statements to deal with exception are executed Statement following entire try-catch statement 11

12 Simple Exception-Handling Example: Divide by Zero Keyword throw Throws an exception» Use when error occurs Can throw almost anything (exception object, integer, etc.)» throw myobject;» throw 5; Exception objects Base class exception ( <exception> ) Constructor can take a string (to describe exception) Member function what() returns that string 12

13 #include <iostream> using namespace std; Creating an error object to throw class DivideByZeroError { public: DivideByZeroError() : message("divide by Zero") { void printmessage() const {cout << message; private: const char* message; ; int main(){ DivideByZeroError err; err.printmessage(); return 0; Divide by Zero 13

14 Divide Function that throws an exception #include <iostream> using namespace std; float quotient(int numerator, int denominator) { if (denominator == 0) throw DivideByZeroError(); return (float) numerator / denominator; int main(){ int i = 10, j = 3; cout << quotient(i,j) << \n ; return 0;

15 Execution Generating an Error (without try block) #include <iostream.h> float quotient(int numerator, int denominator) { if (denominator == 0) throw DivideByZeroError(); return (float) numerator / denominator; main(){ int i = 10, j = 0; cout << quotient(i,j); return 0; TESTPROG.EXE PROGRAM ABORTED OK 15

16 Simple Exception-Handling Example: Divide by Zero Next example Handle divide-by-zero errors Define new exception class» DivideByZeroException» Inherit from exception In division function» Test denominator» If zero, throw exception (throw object) In try block» Attempt to divide» Have enclosing catch block Catch DivideByZeroException objects 16

17 1 // Fig. 13.1: fig13_01.cpp 2 // A simple exception-handling example that checks for 3 // divide-by-zero exceptions. 4 #include <iostream> 5 6 using std::cout; 7 using std::cin; 8 using std::endl; 9 10 #include <exception> using std::exception; // DivideByZeroException objects should be thrown by functions 15 // upon detecting division-by-zero exceptions 16 class DivideByZeroException : public exception { public: // constructor specifies default error message 21 DivideByZeroException::DivideByZeroException() 22 : exception( "attempted to divide by zero" ) { ; // end class DivideByZeroException 25 Define new exception class (inherit from exception). Pass a descriptive message to the constructor. Outline fig13_01.cpp (1 of 3) 2003 Prentice Hall, Inc. All rights reserved.

18 26 // perform division and throw DivideByZeroException object if 27 // divide-by-zero exception occurs 28 double quotient( int numerator, int denominator ) 29 { 30 // throw DivideByZeroException if trying to divide by zero 31 if ( denominator == 0 ) 32 throw DivideByZeroException(); // terminate function // return division result 35 return static_cast< double >( numerator ) / denominator; // end function quotient int main() 40 { If the denominator is zero, throw a DivideByZeroException object. 41 int number1; // user-specified numerator 42 int number2; // user-specified denominator 43 double result; // result of division cout << "Enter two integers (end-of-file to end): "; 46 Outline fig13_01.cpp (2 of 3) 2003 Prentice Hall, Inc. All rights reserved.

19 47 // enable user to enter two integers to divide 48 while ( cin >> number1 >> number2 ) { // try block contains code that might throw exception 51 // and code that should not execute if an exception occurs 52 try { 53 result = quotient( number1, number2 ); 54 cout << "The quotient is: " << result << endl; // end try // exception handler handles a divide-by-zero exception 59 catch ( DivideByZeroException &dividebyzeroexception ) { 60 cout << "Exception occurred: " 61 << dividebyzeroexception.what() << endl; // end catch 64 Notice the structure of the try 65 cout << "\nenter two integers (end-of-file to end): "; // end while cout << endl; return 0; // terminate normally // end main and catch blocks. The catch block can catch DivideByZeroException objects, and print an error message. If no exception occurs, the catch block is skipped. Member function what returns the string describing the exception. Outline fig13_01.cpp (3 of 3) 2003 Prentice Hall, Inc. All rights reserved.

20 Enter two integers (end-of-file to end): The quotient is: Enter two integers (end-of-file to end): Exception occurred: attempted to divide by zero Outline fig13_01.cpp output (1 of 1) Enter two integers (end-of-file to end): ^Z 2003 Prentice Hall, Inc. All rights reserved.

21 Executing Code in a try block int main(){ cout << "Enter numerator and denominator: "; int numerator, denominator; cin >> numerator >> denominator; try { float answer = quotient(numerator, denominator); cout << "\n" << numerator << "/" << denominator << " = " << answer; catch (DivideByZeroError error) { //error handler cout << "ERROR: "; error.printmessage(); cout << endl; return 1; //terminate because of error return 0; //terminate normally Enter numerator and denominator: 3 4 3/4 =

22 ...Executing Code in a try block main(){ cout << "Enter numerator and denominator: "; int numerator, denominator; cin >> numerator >> denominator; try { float answer = quotient(numerator, denominator); cout << "\n" << numerator << "/" << denominator << " = " << answer; catch (DivideByZeroError error) { //error handler cout << "ERROR: "; error.printmessage(); cout << endl; return 1; //terminate because of error return 0; //terminate normally Enter numerator and denominator: 3 0 ERROR: Divide by Zero 22

23 Throwing an Exception When a program encounters an error it throws an exception using throw anobject anobject can be any type of object and is called the exception object Exception will be caught by the closest exception handler (for the try block from which the exception was thrown) which matches the exception object type A temporary copy of the exception object is created and initialized, which in turn initializes the parameter in the exception handler The temporary object is destroyed when the exception handler completes execution 23

24 ...Throwing an Exception class DivideByZeroError { public: DivideByZeroError() : message("divide by Zero") {cout << "construct: DivByZeroObject\n"; ~DivideByZeroError() {cout << "delete: DivByZeroObject\n"; void printmessage() const {cout << message; private: const char* message; ; Enter numerator and denominator: 3 0 construct: DivByZeroObject delete: DivByZeroObject ERROR: Divide by Zero delete: DivByZeroObject delete: DivByZeroObject 24

25 Constructors, Destructors and Exception Handling Error in constructor new fails; cannot allocate memory Cannot return a value - how to inform user?» Hope user examines object, notices errors» Set some global variable Good alternative: throw an exception» Destructors automatically called for member objects» Called for automatic variables in try block Can catch exceptions in destructor 25

26 Executing Code in a try block main(){ cout << "Enter numerator and denominator: "; int numerator, denominator; cin >> numerator >> denominator; try { float answer = quotient(numerator, denominator); cout << "\n" << numerator << "/" << denominator << " = " << answer; catch (DivideByZeroError error) { //error handler cout << "ERROR: "; error.printmessage(); cout << endl; return 1; //terminate because of error return 0; Enter numerator and denominator: 3 0 construct: DivByZeroObject delete: DivByZeroObject ERROR: Divide by Zero delete: DivByZeroObject delete: DivByZeroObject 26

27 Throwing an Exception Control exits the current try block and goes to appropriate catch handler The try blocks or functions which throw the exception can be deeply nested An exception can be thrown by code indirectly referenced from within a try block An exception terminates the block in which the exception occurred, and may cause program termination 27

28 Catching an Exception Exception handlers are contained within catch blocks catch(exception_object) { //exception handler code Catch handler specifies the type of object that it catches Exceptions which are not caught will cause program termination, by invoking function terminate, which in turn invokes abort 28

29 ...Catching an Exception Specifying only the exception type is allowed, no object is passed, the type is simply used to select the appropriate handler catch(exception_type) { //exception handler code Specifying ellipses catches all exceptions catch(...) { //exception handler code 29

30 Unnamed Exception Handlers -only type specified try { float answer = quotient(numerator, denominator); cout << "\n"; cout << numerator << "/" << denominator << " = " << answer; catch (DivideByZeroError) { //type only error handler cout << "ERROR: DIVIDE_BY_ZERO\n"; return 1; //terminate because of error Enter numerator and denominator: 3 0 construct: DivByZeroObject delete: DivByZeroObject ERROR: DIVIDE_BY_ZERO delete: DivByZeroObject delete: DivByZeroObject 30

31 Catching all Exceptions try { float answer = quotient(numerator, denominator); cout << "\n"; cout << numerator << "/" << denominator << " = " << answer; catch (...) { //error handler cout << "ERROR: ERROR_IN_PROGRAM\n"; return 1; //terminate because of error One fewer destructors ran Enter numerator and denominator: 3 0 construct: DivByZeroObject delete: DivByZeroObject ERROR: ERROR_IN_PROGRAM delete: DivByZeroObject 31

32 ... Throwing ints, doubles, etc main(){ int n = 5; double x = 5.0; try { cout << n << " factorial is " << factorial(n) <<"\n"; catch (int error) { //error handler cout << "\nerror INTEGER = " << error << "\n"; if (error < 0) cout << "...INT MUST BE GREATER THAN ZERO\n"; return 1; //terminate because of error catch (double error) { //error handler cout << "\nerror Double = " << error << "\n"; cout << "\n...argument CANNOT BE TYPE double\n"; return 1; //terminate because of error return 0; 5 factorial is

33 ... Throwing ints, doubles, etc main(){ int n = -5; double x = 5.0; try { cout << n << " factorial is " << factorial(n) <<"\n"; catch (int error) { //error handler cout << "\nerror INTEGER = " << error << "\n"; if (error < 0) cout << "...INT MUST BE GREATER THAN ZERO\n"; return 1; //terminate because of error catch (double error) { //error handler cout << "\nerror Double = " << error << "\n"; cout << "\n...argument CANNOT BE TYPE double\n"; return 1; //terminate because of error return 0; ERROR INTEGER = -5...INT MUST BE GREATER THAN ZERO 33

34 ... Throwing ints, doubles, etc main(){ int n = -5; double x = 5.0; try { cout << x << " factorial is " << factorial(x) <<"\n"; catch (int error) { //error handler cout << "\nerror INTEGER = " << error << "\n"; if (error < 0) cout << "...INT MUST BE GREATER THAN ZERO\n"; return 1; //terminate because of error catch (double error) { //error handler cout << "\nerror Double = " << error << "\n"; cout << "\n...argument CANNOT BE TYPE double\n"; return 1; //terminate because of error return 0; ERROR Double = 5...ARGUMENT CANNOT BE TYPE double 34

35 Throwing from Conditional Expressions main(){ int n = 5; double x = 5.0; try { n < 0? throw int(n) : cout << factorial(n); catch (int error) { //error handler cout << "\nerror INTEGER = " << error << "\n"; if (error < 0) cout << "...INT MUST BE GREATER THAN ZERO\n"; return 1; //terminate because of error catch (double error) { //error handler cout << "\nerror Double = " << error << "\n"; cout << "\n...argument CANNOT BE TYPE double\n"; return 1; //terminate because of error return 0; //terminate normally

36 ...Throwing from Conditional Expressions main(){ int n = -5; double x = 5.0; try { n < 0? throw int(n) : cout << factorial(n); catch (int error) { //error handler cout << "\nerror INTEGER = " << error << "\n"; if (error < 0) cout << "...INT MUST BE GREATER THAN ZERO\n"; return 1; //terminate because of error catch (double error) { //error handler cout << "\nerror Double = " << error << "\n"; cout << "\n...argument CANNOT BE TYPE double\n"; return 1; //terminate because of error ERROR INTEGER = -5 return 0;...INT MUST BE GREATER THAN ZERO 36

37 ...Throwing from Conditional Expressions main(){ int n = -5; double x = 5.0; try { n < 0? throw int(n) : throw double(x); catch... ERROR INTEGER = -5...INT MUST BE GREATER THAN ZERO main(){ int n = 5; double x = 5.0; try { n < 0? throw int(n) : throw double(x); catch... ERROR Double = 5...ARGUMENT CANNOT BE TYPE double 37

38 ...Continuing After an Exception main(){ int n = -5; double x = 5.0; try { cout << n << " factorial is " << factorial(n) <<"\n"; catch (int error) { //error handler cout << "\nerror INTEGER = " << error << "\n"; if (error < 0) cout << "...INT MUST BE GREATER THAN ZERO\n"; return 1; //terminate because of an error catch (double error) { //error handler cout << "\nerror Double = " << error << "\n"; cout << "\n...argument CANNOT BE TYPE double\n"; return 1; //terminate because of error cout << "\n...processing continues...\n"; return 0; //terminate normally 38

39 Continuing After an Exception main(){ int n = -5; double x = 5.0; try { cout << n << " factorial is " << factorial(n) <<"\n"; catch (int error) { //error handler cout << "\nerror INTEGER = " << error << "\n"; if (error < 0) cout << "...INT MUST BE GREATER THAN ZERO\n"; return 1; //terminate because of an error catch (double error) { //error handler cout << "\nerror Double = " << error << "\n"; cout << "\n...argument CANNOT BE TYPE double\n"; return 1; //terminate because of error cout << "\n...processing continues...\n"; return 0; //terminate normally ERROR INTEGER = -5...INT MUST BE GREATER THAN ZERO 39

40 ...Continuing After an Exception main(){ int n = -5; double x = 5.0; try { cout << n << " factorial is " << factorial(n) <<"\n"; catch (int error) { //error handler cout << "\nerror INTEGER = " << error << "\n"; if (error < 0) cout << "...INT MUST BE GREATER THAN ZERO\n"; return 0; //return indicating normal termination catch (double error) { //error handler cout << "\nerror Double = " << error << "\n"; cout << "\n...argument CANNOT BE TYPE double\n"; return 1; //terminate because of error Same Result cout << "\n...processing continues...\n"; return 0; //terminate normally ERROR INTEGER = -5...INT MUST BE GREATER THAN ZERO 40

41 ...Continuing After an Exception (No Return Specified) main(){ int n = -5; double x = 5.0; try { cout << n << " factorial is " << factorial(n) <<"\n"; catch (int error) { //error handler cout << "\nerror INTEGER = " << error << "\n"; if (error < 0) cout << "...INT MUST BE GREATER THAN ZERO\n"; catch (double error) { //error handler cout << "\nerror Double = " << error << "\n"; cout << "\n...argument CANNOT BE TYPE double\n"; return 1; //terminate because of error cout << "\n...processing ERROR INTEGER continues...\n"; = -5 return 0; //terminate...int normally MUST BE GREATER THAN ZERO...processing continues... 41

42 Example //mismatch type, throw integer type //catch the double type... #include <iostream.h> void Funct(); int main() { try { Funct(); catch(double) { cerr<<"caught a double type..."<<endl; return 0; void Funct() { //3 is not a double but int throw 3; Output: Change the following statement throw 3; to throw 4.123; Output: 42

43 Processing Unexpected Exceptions unexpected() set_unexpected() terminate() set_terminate() abort() exit 43

44 Standard Exception Hierarchies 44

45 Standard Exceptions The C++ exception class serves as the base class for all exceptions thrown by certain expressions and by the Standard C++ Library. 45

46 46

47 47

Exception Handling Pearson Education, Inc. All rights reserved.

Exception Handling Pearson Education, Inc. All rights reserved. 1 16 Exception Handling 2 16.1 Introduction Exceptions Indicate problems that occur during a program s execution Occur infrequently Exception handling Can resolve exceptions Allow a program to continue

More information

IS 0020 Program Design and Software Tools

IS 0020 Program Design and Software Tools 1 Introduction 2 IS 0020 Program Design and Software Tools Exception Handling Lecture 12 November 23, 200 Exceptions Indicates problem occurred in program Not common An "exception" to a program that usually

More information

Exception Handling in C++

Exception Handling in C++ Exception Handling in C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie, Absolute C++, by

More information

! Errors can be dealt with at place error occurs

! Errors can be dealt with at place error occurs UCLA Stat 1D Statistical Computing and Visualization in C++ Instructor: Ivo Dinov, Asst. Prof. in Statistics / Neurology University of California, Los Angeles, Winter 200 http://www.stat.ucla.edu/~dinov/courses_students.html

More information

Exception Handling Pearson Education, Inc. All rights reserved.

Exception Handling Pearson Education, Inc. All rights reserved. 1 16 Exception Handling 2 I never forget a face, but in your case I ll make an exception. Groucho Marx It is common sense to take a method and try it. If it fails, admit it frankly and try another. But

More information

21. Exceptions. Advanced Concepts: // exceptions #include <iostream> using namespace std;

21. Exceptions. Advanced Concepts: // exceptions #include <iostream> using namespace std; - 147 - Advanced Concepts: 21. Exceptions Exceptions provide a way to react to exceptional circumstances (like runtime errors) in our program by transferring control to special functions called handlers.

More information

Lecture 10. To use try, throw, and catch Constructors and destructors Standard exception hierarchy new failures

Lecture 10. To use try, throw, and catch Constructors and destructors Standard exception hierarchy new failures Lecture 10 Class string Exception Handling To use try, throw, and catch Constructors and destructors Standard exception hierarchy new failures Class template auto_ptr Lec 10 Programming in C++ 1 Class

More information

Introduction. Common examples of exceptions

Introduction. Common examples of exceptions Exception Handling Introduction Common examples of exceptions Failure of new to obtain memory Out-of-bounds array subscript Division by zero Invalid function parameters Programs with exception handling

More information

Exception with arguments

Exception with arguments Exception Handling Introduction : Fundamental Syntax for Exception Handling code : try catch throw Multiple exceptions Exception with arguments Introduction Exception: An abnormal condition that arises

More information

CSC 330. An Exception is. Handling Exceptions. Error Handling. Assertions. C++ Exception. Example

CSC 330. An Exception is. Handling Exceptions. Error Handling. Assertions. C++ Exception. Example An Exception is CSC 330 Handling Exceptions CSC330 OO Software Design 1 An unusual, often unpredictable event, detectable by software or hardware, that requires special processing; also, in C++, a variable

More information

Exceptions, Case Study-Exception handling in C++.

Exceptions, Case Study-Exception handling in C++. PART III: Structuring of Computations- Structuring the computation, Expressions and statements, Conditional execution and iteration, Routines, Style issues: side effects and aliasing, Exceptions, Case

More information

Outline. Introduction. Arrays declarations and initialization. Const variables. Character arrays. Static arrays. Examples.

Outline. Introduction. Arrays declarations and initialization. Const variables. Character arrays. Static arrays. Examples. Outline Introduction. Arrays declarations and initialization. Const variables. Character arrays. Static arrays. Examples. 1 Arrays I Array One type of data structures. Consecutive group of memory locations

More information

CHAPTER 2.1 CONTROL STRUCTURES (SELECTION) Dr. Shady Yehia Elmashad

CHAPTER 2.1 CONTROL STRUCTURES (SELECTION) Dr. Shady Yehia Elmashad CHAPTER 2.1 CONTROL STRUCTURES (SELECTION) Dr. Shady Yehia Elmashad Outline 1. The if Selection Structure 2. The if/else Selection Structure 3. The switch Multiple-Selection Structure 1. The if Selection

More information

Programming in C++: Assignment Week 8

Programming in C++: Assignment Week 8 Programming in C++: Assignment Week 8 Total Marks : 20 September 9, 2017 Question 1 Consider the following code segment. Mark 2 void myfunction(int test) { try { if (test) throw test; else throw "Value

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 6 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Spring 2011 These slides are created using Deitel s slides Sharif University of Technology Outlines

More information

Chapter 2 - Control Structures

Chapter 2 - Control Structures Chapter 2 - Control Structures 1 Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures 2.5 if Selection Structure 2.6 if/else Selection Structure 2.7 while Repetition Structure

More information

CS102 C++ Exception Handling & Namespaces

CS102 C++ Exception Handling & Namespaces CS102 C++ Exception Handling & Namespaces Bill Cheng http://merlot.usc.edu/cs102-s12 1 Topics to cover C Structs (Ch 10) C++ Classes (Ch 11) Constructors Destructors Member functions Exception Handling

More information

05-01 Discussion Notes

05-01 Discussion Notes 05-01 Discussion Notes PIC 10B Spring 2018 1 Exceptions 1.1 Introduction Exceptions are used to signify that a function is being used incorrectly. Once an exception is thrown, it is up to the programmer

More information

C++ PROGRAMMING LANGUAGE: DYNAMIC MEMORY ALLOCATION AND EXCEPTION IN C++. CAAM 519, CHAPTER 15

C++ PROGRAMMING LANGUAGE: DYNAMIC MEMORY ALLOCATION AND EXCEPTION IN C++. CAAM 519, CHAPTER 15 C++ PROGRAMMING LANGUAGE: DYNAMIC MEMORY ALLOCATION AND EXCEPTION IN C++. CAAM 519, CHAPTER 15 This chapter introduces the notion of dynamic memory allocation of variables and objects in a C++ program.

More information

CHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad

CHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad CHAPTER 4 FUNCTIONS Dr. Shady Yehia Elmashad Outline 1. Introduction 2. Program Components in C++ 3. Math Library Functions 4. Functions 5. Function Definitions 6. Function Prototypes 7. Header Files 8.

More information

Programming in C++: Assignment Week 8

Programming in C++: Assignment Week 8 Programming in C++: Assignment Week 8 Total Marks : 20 Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology Kharagpur 721302 partha.p.das@gmail.com April 12,

More information

Introduction to C++ Systems Programming

Introduction to C++ Systems Programming Introduction to C++ Systems Programming Introduction to C++ Syntax differences between C and C++ A Simple C++ Example C++ Input/Output C++ Libraries C++ Header Files Another Simple C++ Example Inline Functions

More information

The format for declaring function templates with type parameters

The format for declaring function templates with type parameters UNIT 3 Function and class templates - Exception handling try-catch-throw paradigm exception specification terminate and Unexpected functions Uncaught exception. Templates Function templates Function templates

More information

CHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING. Dr. Shady Yehia Elmashad

CHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING. Dr. Shady Yehia Elmashad CHAPTER 1.2 INTRODUCTION TO C++ PROGRAMMING Dr. Shady Yehia Elmashad Outline 1. Introduction to C++ Programming 2. Comment 3. Variables and Constants 4. Basic C++ Data Types 5. Simple Program: Printing

More information

CHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad

CHAPTER 4 FUNCTIONS. Dr. Shady Yehia Elmashad CHAPTER 4 FUNCTIONS Dr. Shady Yehia Elmashad Outline 1. Introduction 2. Program Components in C++ 3. Math Library Functions 4. Functions 5. Function Definitions 6. Function Prototypes 7. Header Files 8.

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

Chapter 1 Introduction to Computers and C++ Programming

Chapter 1 Introduction to Computers and C++ Programming Chapter 1 Introduction to Computers and C++ Programming 1 Outline 1.1 Introduction 1.2 What is a Computer? 1.3 Computer Organization 1.7 History of C and C++ 1.14 Basics of a Typical C++ Environment 1.20

More information

CPSC 427: Object-Oriented Programming

CPSC 427: Object-Oriented Programming CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 19 November 7, 2018 CPSC 427, Lecture 19, November 7, 2018 1/18 Exceptions Thowing an Exception Catching an Exception CPSC 427, Lecture

More information

Introduction to Programming

Introduction to Programming Introduction to Programming session 5 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology Outlines

More information

C++ Exception Handling 1

C++ Exception Handling 1 C++ Exception Handling 1 An exception is a problem that arises during the execution of a program. A C++ exception is a response to an exceptional circumstance that arises while a program is running, such

More information

Recharge (int, int, int); //constructor declared void disply();

Recharge (int, int, int); //constructor declared void disply(); Constructor and destructors in C++ Constructor Constructor is a special member function of the class which is invoked automatically when new object is created. The purpose of constructor is to initialize

More information

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor. 3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.

More information

TEMPLATES AND EXCEPTION HANDLING

TEMPLATES AND EXCEPTION HANDLING CONTENTS: Function template Class template Exception handling Try-Catch-Throw paradigm Exception specification Terminate functions Unexcepted functions Uncaught exception UNIT-III TEMPLATES AND EXCEPTION

More information

Chapter 15 - C++ As A "Better C"

Chapter 15 - C++ As A Better C Chapter 15 - C++ As A "Better C" Outline 15.1 Introduction 15.2 C++ 15.3 A Simple Program: Adding Two Integers 15.4 C++ Standard Library 15.5 Header Files 15.6 Inline Functions 15.7 References and Reference

More information

Outline. Introduction. Pointer variables. Pointer operators. Calling functions by reference. Using const with pointers. Examples.

Outline. Introduction. Pointer variables. Pointer operators. Calling functions by reference. Using const with pointers. Examples. Outline Introduction. Pointer variables. Pointer operators. Calling functions by reference. Using const with pointers. Examples. 1 Introduction A pointer is a variable that contains a memory address Pointers

More information

COMP322 - Introduction to C++ Lecture 10 - Overloading Operators and Exceptions

COMP322 - Introduction to C++ Lecture 10 - Overloading Operators and Exceptions COMP322 - Introduction to C++ Lecture 10 - Overloading Operators and Exceptions Dan Pomerantz School of Computer Science 19 March 2012 Overloading operators in classes It is useful sometimes to define

More information

Functions and Recursion

Functions and Recursion Functions and Recursion 1 Storage Classes Scope Rules Functions with Empty Parameter Lists Inline Functions References and Reference Parameters Default Arguments Unary Scope Resolution Operator Function

More information

JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University)

JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli (An approved by AICTE and Affiliated to Anna University) Estd: 1994 JAYARAM COLLEGE OF ENGINEERING AND TECHNOLOGY Pagalavadi, Tiruchirappalli - 621014 (An approved by AICTE and Affiliated to Anna University) ISO 9001:2000 Certified Subject Code & Name : CS 1202

More information

Object-Oriented Programming (OOP) Fundamental Principles of OOP

Object-Oriented Programming (OOP) Fundamental Principles of OOP Object-Oriented Programming (OOP) O b j e c t O r i e n t e d P r o g r a m m i n g 1 Object-oriented programming is the successor of procedural programming. The problem with procedural programming is

More information

C++ Crash Kurs. Exceptions. Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck

C++ Crash Kurs. Exceptions. Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck C++ Crash Kurs Exceptions Dr. Dennis Pfisterer Institut für Telematik, Universität zu Lübeck http://www.itm.uni-luebeck.de/people/pfisterer C++ Exceptions: Introduction What are exceptions Exceptions are

More information

CPSC 427: Object-Oriented Programming

CPSC 427: Object-Oriented Programming CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 22 November 28, 2016 CPSC 427, Lecture 22 1/43 Exceptions (continued) Code Reuse Linear Containers Ordered Containers Multiple Inheritance

More information

Operator Overloading in C++ Systems Programming

Operator Overloading in C++ Systems Programming Operator Overloading in C++ Systems Programming Operator Overloading Fundamentals of Operator Overloading Restrictions on Operator Overloading Operator Functions as Class Members vs. Global Functions Overloading

More information

A Tour of the C++ Programming Language

A Tour of the C++ Programming Language A Tour of the C++ Programming Language We already know C Everything that can be done with a computer, can be done in C Why should we learn another language? Newer languages provide a bigger toolbox Some

More information

Ch. 12: Operator Overloading

Ch. 12: Operator Overloading Ch. 12: Operator Overloading Operator overloading is just syntactic sugar, i.e. another way to make a function call: shift_left(42, 3); 42

More information

COMP6771 Advanced C++ Programming

COMP6771 Advanced C++ Programming 1.... COMP6771 Advanced C++ Programming Week 5 Part One: Exception Handling 2016 www.cse.unsw.edu.au/ cs6771 2.... Memory Management & Exception Handling.1 Part I: Exception Handling Exception objects

More information

C++ Namespaces, Exceptions

C++ Namespaces, Exceptions C++ Namespaces, Exceptions CSci 588: Data Structures, Algorithms and Software Design http://www.cplusplus.com/doc/tutorial/namespaces/ http://www.cplusplus.com/doc/tutorial/exceptions/ http://www.cplusplus.com/doc/tutorial/typecasting/

More information

Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays

Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays Tutorial 13 Salary Survey Application: Introducing One- Dimensional Arrays Outline 13.1 Test-Driving the Salary Survey Application 13.2 Introducing Arrays 13.3 Declaring and Initializing Arrays 13.4 Constructing

More information

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT

Jayaram college of Engineering and Technology, Pagalavadi. CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT CS2203 Object Oriented Programming Question Bank Prepared By: S.Gopalakrishnan, Lecturer/IT Two Mark Questions UNIT - I 1. DEFINE ENCAPSULATION. Encapsulation is the process of combining data and functions

More information

Introduction to C++ Programming. Adhi Harmoko S, M.Komp

Introduction to C++ Programming. Adhi Harmoko S, M.Komp Introduction to C++ Programming Adhi Harmoko S, M.Komp Machine Languages, Assembly Languages, and High-level Languages Three types of programming languages Machine languages Strings of numbers giving machine

More information

Chapter 3 - Functions

Chapter 3 - Functions Chapter 3 - Functions 1 Outline 3.1 Introduction 3.2 Program Components in C++ 3.3 Math Library Functions 3.4 Functions 3.5 Function Definitions 3.6 Function Prototypes 3.7 Header Files 3.8 Random Number

More information

AN OVERVIEW OF C++ 1

AN OVERVIEW OF C++ 1 AN OVERVIEW OF C++ 1 OBJECTIVES Introduction What is object-oriented programming? Two versions of C++ C++ console I/O C++ comments Classes: A first look Some differences between C and C++ Introducing function

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 4: Control Structures I (Selection) Control Structures A computer can proceed: In sequence Selectively (branch) - making

More information

Intermediate Programming, Spring 2017*

Intermediate Programming, Spring 2017* 600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general

More information

Fast Introduction to Object Oriented Programming and C++

Fast Introduction to Object Oriented Programming and C++ Fast Introduction to Object Oriented Programming and C++ Daniel G. Aliaga Note: a compilation of slides from Jacques de Wet, Ohio State University, Chad Willwerth, and Daniel Aliaga. Outline Programming

More information

C++_ MARKS 40 MIN

C++_ MARKS 40 MIN C++_16.9.2018 40 MARKS 40 MIN https://tinyurl.com/ya62ayzs 1) Declaration of a pointer more than once may cause A. Error B. Abort C. Trap D. Null 2Whice is not a correct variable type in C++? A. float

More information

CPSC 427: Object-Oriented Programming

CPSC 427: Object-Oriented Programming CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 7 September 21, 2016 CPSC 427, Lecture 7 1/21 Brackets Example (continued) Storage Management CPSC 427, Lecture 7 2/21 Brackets Example

More information

Data Structures using OOP C++ Lecture 3

Data Structures using OOP C++ Lecture 3 References: th 1. E Balagurusamy, Object Oriented Programming with C++, 4 edition, McGraw-Hill 2008. 2. Robert L. Kruse and Alexander J. Ryba, Data Structures and Program Design in C++, Prentice-Hall 2000.

More information

Exception handling. Aishy Amer. Lecture Outline: Introduction Types or errors or exceptions Conventional error processing Exception handling in C++

Exception handling. Aishy Amer. Lecture Outline: Introduction Types or errors or exceptions Conventional error processing Exception handling in C++ Exception handling Aishy Amer Electrical & Computer Engineering Concordia University Lecture Outline: Introduction Types or errors or exceptions Conventional error processing Exception handling in C++

More information

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable Basic C++ Overview C++ is a version of the older C programming language. This is a language that is used for a wide variety of applications and which has a mature base of compilers and libraries. C++ is

More information

CHAPTER 3 ARRAYS. Dr. Shady Yehia Elmashad

CHAPTER 3 ARRAYS. Dr. Shady Yehia Elmashad CHAPTER 3 ARRAYS Dr. Shady Yehia Elmashad Outline 1. Introduction 2. Arrays 3. Declaring Arrays 4. Examples Using Arrays 5. Multidimensional Arrays 6. Multidimensional Arrays Examples 7. Examples Using

More information

Kingdom of Saudi Arabia Princes Nora bint Abdul Rahman University College of Computer Since and Information System CS242 ARRAYS

Kingdom of Saudi Arabia Princes Nora bint Abdul Rahman University College of Computer Since and Information System CS242 ARRAYS Kingdom of Saudi Arabia Princes Nora bint Abdul Rahman University College of Computer Since and Information System CS242 1 ARRAYS Arrays 2 Arrays Structures of related data items Static entity (same size

More information

IS 0020 Program Design and Software Tools

IS 0020 Program Design and Software Tools 1 IS 0020 Program Design and Software Tools Introduction to C++ Programming Spring 2005 Lecture 1 Jan 6, 2005 Course Information 2 Lecture: James B D Joshi Tuesdays/Thursdays: 1:00-2:15 PM Office Hours:

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

Constructor - example

Constructor - example Constructors A constructor is a special member function whose task is to initialize the objects of its class. It is special because its name is same as the class name. The constructor is invoked whenever

More information

! An exception is a condition that occurs at execution time and makes normal continuation of the program impossible.

! An exception is a condition that occurs at execution time and makes normal continuation of the program impossible. Exceptions! Exceptions are used to signal error or unexpected events that occur while a program is running.! An exception is a condition that occurs at execution time and makes normal continuation of the

More information

Programming. C++ Basics

Programming. C++ Basics Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++

More information

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004

GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004 GE U111 Engineering Problem Solving & Computation Lecture 6 February 2, 2004 Functions and Program Structure Today we will be learning about functions. You should already have an idea of their uses. Cout

More information

Engineering Problem Solving with C++, 3e Chapter 2 Test Bank

Engineering Problem Solving with C++, 3e Chapter 2 Test Bank 1. Match each of the following data types with literal constants of that data type. A data type can be used more than once. A. integer B 1.427E3 B. double D "Oct" C. character B -63.29 D. string F #Hashtag

More information

Chapter 18 - C++ Operator Overloading

Chapter 18 - C++ Operator Overloading Chapter 18 - C++ Operator Overloading Outline 18.1 Introduction 18.2 Fundamentals of Operator Overloading 18.3 Restrictions on Operator Overloading 18.4 Operator Functions as Class Members vs. as friend

More information

Chapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d.

Chapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d. Chapter 4: Control Structures I (Selection) In this chapter, you will: Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)

More information

In this chapter you will learn:

In this chapter you will learn: 1 In this chapter you will learn: Essentials of counter-controlled repetition. Use for, while and do while to execute statements in program repeatedly. Use nested control statements in your program. 2

More information

Arrays. Week 4. Assylbek Jumagaliyev

Arrays. Week 4. Assylbek Jumagaliyev Arrays Week 4 Assylbek Jumagaliyev a.jumagaliyev@iitu.kz Introduction Arrays Structures of related data items Static entity (same size throughout program) A few types Pointer-based arrays (C-like) Arrays

More information

Computer Programming with C++ (21)

Computer Programming with C++ (21) Computer Programming with C++ (21) Zhang, Xinyu Department of Computer Science and Engineering, Ewha Womans University, Seoul, Korea zhangxy@ewha.ac.kr Classes (III) Chapter 9.7 Chapter 10 Outline Destructors

More information

Homework 4. Any questions?

Homework 4. Any questions? CSE333 SECTION 8 Homework 4 Any questions? STL Standard Template Library Has many pre-build container classes STL containers store by value, not by reference Should try to use this as much as possible

More information

Chapter 2 - Control Structures

Chapter 2 - Control Structures Chapter 2 - Control Structures 1 Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures 2.5 if Selection Structure 2.6 if/else Selection Structure 2.7 while Repetition Structure

More information

mywbut.com Exception Handling

mywbut.com Exception Handling Exception Handling An exception is a run-time error. Proper handling of exceptions is an important programming issue. This is because exceptions can and do happen in practice and programs are generally

More information

THE NAME OF THE CONSTRUCTOR AND DESTRUCTOR(HAVING (~) BEFORE ITS NAME) FUNCTION MUST BE SAME AS THE NAME OF THE CLASS IN WHICH THEY ARE DECLARED.

THE NAME OF THE CONSTRUCTOR AND DESTRUCTOR(HAVING (~) BEFORE ITS NAME) FUNCTION MUST BE SAME AS THE NAME OF THE CLASS IN WHICH THEY ARE DECLARED. Constructor and Destructor Member Functions Constructor: - Constructor function gets invoked automatically when an object of a class is constructed (declared). Destructor:- A destructor is a automatically

More information

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011

CSCI 102L - Data Structures Midterm Exam #1 Fall 2011 Print Your Name: Page 1 of 8 Signature: Aludra Loginname: CSCI 102L - Data Structures Midterm Exam #1 Fall 2011 (10:00am - 11:12am, Wednesday, October 5) Instructor: Bill Cheng Problems Problem #1 (24

More information

UEE1303(1070) S12: Object-Oriented Programming Advanced Topics of Class

UEE1303(1070) S12: Object-Oriented Programming Advanced Topics of Class UEE1303(1070) S12: Object-Oriented Programming Advanced Topics of Class What you will learn from Lab 6 In this laboratory, you will learn the advance topics of object-oriented programming using class.

More information

CPSC 427: Object-Oriented Programming

CPSC 427: Object-Oriented Programming CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 10 October 1, 2018 CPSC 427, Lecture 10, October 1, 2018 1/20 Brackets Example (continued from lecture 8) Stack class Brackets class Main

More information

CS242 COMPUTER PROGRAMMING

CS242 COMPUTER PROGRAMMING CS242 COMPUTER PROGRAMMING I.Safa a Alawneh Variables Outline 2 Data Type C++ Built-in Data Types o o o o bool Data Type char Data Type int Data Type Floating-Point Data Types Variable Declaration Initializing

More information

Extending Classes (contd.) (Chapter 15) Questions:

Extending Classes (contd.) (Chapter 15) Questions: Extending Classes (contd.) (Chapter 15) Questions: 1 Virtual Functions in C++ Employee /\ / \ ---- Manager 2 Case 1: class Employee { string firstname, lastname; //... Employee( string fnam, string lnam

More information

Functions and Recursion

Functions and Recursion Functions and Recursion 1 Outline Introduction Program Components in C++ Math Library Functions Functions Function Definitions Function Prototypes Header Files Random Number Generation Example: A Game

More information

C++ Programming Fundamentals

C++ Programming Fundamentals C++ Programming Fundamentals 281 Elvis C. Foster Lecture 12: Exception Handling One of the things you are required to do as a responsible programmer is to ensure that your program allows only valid data

More information

Lecture 8: Object-Oriented Programming (OOP) EE3490E: Programming S1 2017/2018 Dr. Đào Trung Kiên Hanoi Univ. of Science and Technology

Lecture 8: Object-Oriented Programming (OOP) EE3490E: Programming S1 2017/2018 Dr. Đào Trung Kiên Hanoi Univ. of Science and Technology Lecture 8: Object-Oriented Programming (OOP) 1 Introduction to C++ 2 Overview Additional features compared to C: Object-oriented programming (OOP) Generic programming (template) Many other small changes

More information

Arithmetic Operators. Binary Arithmetic Operators. Arithmetic Operators. A Closer Look at the / Operator. A Closer Look at the % Operator

Arithmetic Operators. Binary Arithmetic Operators. Arithmetic Operators. A Closer Look at the / Operator. A Closer Look at the % Operator 1 A Closer Look at the / Operator Used for performing numeric calculations C++ has unary, binary, and ternary s: unary (1 operand) - binary ( operands) 13-7 ternary (3 operands) exp1? exp : exp3 / (division)

More information

Initializing and Finalizing Objects

Initializing and Finalizing Objects 4 Initializing and Finalizing Objects 147 Content Initializing and Finalizing Objects 4 Constructors Default Constructor Copy Constructor Destructor 148 Initializing Objects: Constructors Initializing

More information

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. 1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol. B. Outputs to the console a floating point number f1 in scientific format

More information

Chapter 6: User-Defined Functions. Objectives (cont d.) Objectives. Introduction. Predefined Functions 12/2/2016

Chapter 6: User-Defined Functions. Objectives (cont d.) Objectives. Introduction. Predefined Functions 12/2/2016 Chapter 6: User-Defined Functions Objectives In this chapter, you will: Learn about standard (predefined) functions Learn about user-defined functions Examine value-returning functions Construct and use

More information

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am CMSC 202 Section 010x Spring 2007 Computer Science II Final Exam Name: Username: Score Max Section: (check one) 0101 - Justin Martineau, Tuesday 11:30am 0102 - Sandeep Balijepalli, Thursday 11:30am 0103

More information

Introduction to C++ Programming Pearson Education, Inc. All rights reserved.

Introduction to C++ Programming Pearson Education, Inc. All rights reserved. 1 2 Introduction to C++ Programming 2 What s in a name? that which we call a rose By any other name would smell as sweet. William Shakespeare When faced with a decision, I always ask, What would be the

More information

CS201 Some Important Definitions

CS201 Some Important Definitions CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data

More information

Object-Oriented Programming for Scientific Computing

Object-Oriented Programming for Scientific Computing Object-Oriented Programming for Scientific Computing Error Handling and Exceptions Ole Klein Interdisciplinary Center for Scientific Computing Heidelberg University ole.klein@iwr.uni-heidelberg.de Summer

More information

A506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each).

A506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each). A506 / C201 Computer Programming II Placement Exam Sample Questions For each of the following, choose the most appropriate answer (2pts each). 1. Which of the following functions is causing a temporary

More information

(5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University

(5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University (5-1) Object-Oriented Programming (OOP) and C++ Instructor - Andrew S. O Fallon CptS 122 (February 4, 2019) Washington State University Key Concepts 2 Object-Oriented Design Object-Oriented Programming

More information

IS 0020 Program Design and Software Tools

IS 0020 Program Design and Software Tools 1 IS 0020 Program Design and Software Tools Introduction to C++ Programming Multiple Inheritance July 26, 2004 22.9 Multiple Inheritance 2 Multiple inheritance Derived class has several base classes Powerful,

More information

Partha Sarathi Mandal

Partha Sarathi Mandal MA 253: Data Structures Lab with OOP Tutorial 1 http://www.iitg.ernet.in/psm/indexing_ma253/y13/index.html Partha Sarathi Mandal psm@iitg.ernet.in Dept. of Mathematics, IIT Guwahati Reference Books Cormen,

More information

G52CPP C++ Programming Lecture 16

G52CPP C++ Programming Lecture 16 G52CPP C++ Programming Lecture 16 Dr Jason Atkin http://www.cs.nott.ac.uk/~jaa/cpp/ g52cpp.html 1 Last Lecture Casting static cast dynamic cast const cast reinterpret cast Implicit type conversion 2 How

More information

1. Match each of the following data types with literal constants of that data type. A data type can be used more than once. A.

1. Match each of the following data types with literal constants of that data type. A data type can be used more than once. A. Engineering Problem Solving With C++ 4th Edition Etter TEST BANK Full clear download (no error formating) at: https://testbankreal.com/download/engineering-problem-solving-with-c-4thedition-etter-test-bank/

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information