Professional Documents
Culture Documents
1
STUDENT’S NAME – Aryaman Sharma
SEMESTER – 2
TOPIC OF EXPERIMENT –
ALGORITHM –
3. In the try block, check the condition (if the test = 0 or 1 or 2). Then throw the
respective statement.
4. Catch the expectation (using catch all) and display the appropriate message.
5. End.
#include <iostream>
using namespace std;
return (a/b);
int main ()
{
int x = 50;
int y = 0;
double z = 0;
try
{
z = division(x, y);
cout<< z <<endl;
}
catch (const char* msg)
{
cout<< msg <<endl;
}
return 0;
OUTPUT –
SEMESTER – 2
TOPIC OF EXPERIMENT –
ALGORITHM –
2. Declare a function and pass arguments, and in the main function, declare the
variables x, y, z and initialize them with their respective values.
3. In the try block, if the condition is true then throw the statement. ( if b=0 then
the number can’t divisible with 0.)
5. End.
PROGRAM CODE –
SUBJECT NAME- OBJECT ORIENTED PROGRAMMING
USING C++ LAB
SUBJECT CODE-CSP-152
SUBJECT NAME- OBJECT ORIENTED PROGRAMMING
USING C++ LAB
SUBJECT CODE-CSP-152
ERRORS ENCOUNTERED DURING PROGRAM’S EXECUTION –
OUTPUT –
Approach the programming tasks using techniques learnt and write pseudo-code.
Choose the right data representation formats based on the requirements of the problem.
Use the comparisons and limitations of the various programming constructs and choose
the right one for the task.