Lab Manual
Lab Manual
Lab Manual
OUTPUT:
OUTPUT:
OUTPUT:
OUTPUT:
OUTPUT:
OUTPUT:
PRACTICAL 4.3
Basic Object Orianted Programming [4320702] ENROLMENT NO.: 239830331093
Aim: write a program to demonstrate use of default arguments.
INPUT:
#include<iostream.h>
#include<conio.h>
void set_point(int x,int y=0);
void main()
{
int p,q;
cout<<"enter x coordinate";
cin>>p;
set_point(p);
cout<<"enter x and y coordinate";
cin>>p>>q;
set_point(p,q);
getch();
}
void set_point(int x,int y)
{
cout<<x<<" "<<y;
}
OUTPUT:
PRACTICAL 4.4
Basic Object Orianted Programming [4320702] ENROLMENT NO.: 239830331093
Aim: write a program to demonstrate use of inline function.
INPUT:
#include<iostream.h>
#include<conio.h>
const float Pi=3.14;
inline float area(int r)
{
return(Pi*r*r);
}
void main()
{
clrscr();
int ra;
cout<<"enter radius";
cin>>ra;
cout<<"area of circle"<<area(ra);
getch();
}
OUTPUT:
PRACTICAL 4.5
OUTPUT:
OUTPUT:
PRACTICAL:6
Basic Object Orianted Programming [4320702] ENROLMENT NO.: 239830331093
Define minimum 5 different classes such as student, distance,
shape, employee, account, inventory, vector, movie-ticket booking, time,
point, etc. with data member & member functions. Also develop programs
to test those classes functionality.
PRACTICAL 6.1
Aim: Develop a class student with data member & member function.
INPUT:
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class student
{
private:
int rollnum;
char name[20];
public:
void getdata()
{
cout<<"Enter roll number:";
cin>>rollnum;
cout<<"Enter name:";
cin>>name;
}
void putdata()
{
cout<<"Your name is:"<<name<<endl;
cout<<"Your roll number is:"<<rollnum;
}
};
void main()
{
student s1;
clrscr();
s1.getdata();
s1.putdata();
getch();
}
OUTPUT: