Professional Documents
Culture Documents
C++ Exp 3.1
C++ Exp 3.1
ALGORITHM:
PROGRAM’S CODE :
#include <iostream>
using namespace std;
int main ()
{
cout<<"\n NAME : SAKSHI KUMARI \n UID : 21BCS9402\n\n";
int x = 50;
}
SUBJECT NAME- OBJECT ORIENTED PROGRAMMING
USING C++ LAB SUBJECT CODE-CSP-152
int y = 0;
double z = 0;
try {
z = division(x, y);
cout<< z <<endl;
}
}
SUBJECT NAME- OBJECT ORIENTED PROGRAMMING
USING C++ LAB SUBJECT CODE-CSP-152
OUTPUT :
( 2) Write a Program to implement the exception handling with the functionality oftesting
the throw restrictions.
ALGROTHIM :
Step 1: start
Step3 :use exception handling (try, throw, catch) concept for finding run time error.
Step 4: in try I take the value of test in int ,float and char
Step5:then throw detect the error and send it to catch
Step6:in catch we caught error by using catch(…) (if data type is not given )
Step 7:stop
PROGRAM’S CODE :
#include <iostream>
#include <conio.h>
}
SUBJECT NAME- OBJECT ORIENTED PROGRAMMING
USING C++ LAB SUBJECT CODE-CSP-152
int main( ) {
cout<<"\n NAME :SAKSHI KUMARI \n UID : 21BCS9402\n\n";
cout<< " Start\n";
handle(0);
handle(1);
handle(2); cout<<
" End"; return 0;
}
OUTPUT :