You are on page 1of 6

II CSE

PROGRAM
#include<iostream.h>
#include<conio.h>
class student
{
int rno,m1,m2;
char name[25];
public:
void getdata()
{
cout<<"Enter the Roll No";
cin>>rno;
cout<<"Enter the Name";
cin>>name;
cout<<"Enter the 2 Marks";
cin>>m1>>m2;
}
void putdata()
{
cout<<"\nRoll No:"<<rno;
cout<<"\nName :"<<name;
cout<<"\nMark1:"<<m1<<" Mark2:"<<m2<<"\n";
}};
void main()
{
clrscr();
student s1,s2;
s1.getdata();
s2.getdata();
cout<<"Student Detail";
s1.putdata();
s2.putdata();
getch();
}

OUTPUT:
Enter the Roll No23

CS6311-Programming and Data Structures II Laboratory

II CSE

Enter
Enter
Enter
Enter
Enter

the
the
the
the
the

NameArun
2 Marks78 89
Roll No45
NameKumar
2 Marks98 79

Student Detail
Roll No:23
Name :Arun
Mark1:78 Mark2:89
Roll No:45
Name :Kumar
Mark1:98 Mark2:79

PROGRAM
#include<iostream.h>
#include<conio.h>

CS6311-Programming and Data Structures II Laboratory

II CSE

class armstrong
{
int n,a,s,r;
public:
void getdata()
{
cout<<"\nEnter the Number";
cin>>n;
a=n;
s=0;
while(n!=0)
{
r=n%10;
s=s+r*r*r;
n=n/10;
}}
void putdata()
{
if(a==s)
cout<<"\nThe Given Number is an armstrong";
else
cout<<"\nThe Given Number is Not an armstrong";
}};
void main()
{
clrscr();
armstrong a;
a.getdata();
a.putdata();
getch();
}
OUTPUT:
Enter the Number153
The Given Number is an armstrong

CS6311-Programming and Data Structures II Laboratory

II CSE

PROGRAM
#include<iostream.h>
#include<conio.h>
class employee
{

CS6311-Programming and Data Structures II Laboratory

II CSE

char name[50];
char address[50];
float salary;
float year;
public:
void getdata()
{
cout<<"Enter the Name...";
cin>>name;
cout<<"Enter the Address...";
cin>>address;
cout<<"Enter the Year of Experience and Salary...";
cin>>year>>salary;
}
void putdata()
{
cout<<"\nName:"<<name<<"\nAddress:"<<address<<"\nYear of
Experience:"<<year<<"\nSalary:"<<salary;
}};
void main()
{
clrscr();
employee e1,e2;
e1.getdata();
e2.getdata();
cout<<"\nEMPLOYEE DETAIL\n";
e1.putdata();
e2.putdata();
getch();
OUTPUT:
Enter The Name...Arun
Enter the Address...Chennai-45
Enter the year of Experience and salary...5 20000
Enter The Name...Kumar
Enter the Address...Chennai-89

CS6311-Programming and Data Structures II Laboratory

II CSE

Enter the year of Experience and salary...10 50000


EMPLOYEE DETAIL
Name:Arun
Address:Chennai-45
Year of Experience:5
Salary:20000
Name:Kumar
Address:Chennai-89
Year of Experience:10
Salary:50000

CS6311-Programming and Data Structures II Laboratory

You might also like