program To Demonstrate Use of Containership

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

//Program to demonstrate use of Containership

#include<iostream>
#include<iomanip>
#include<conio.h>
using namespace std;
class student{
int roll;
char name[20];
public:
void get();
void display();
};
void student::get(){
cout<<" Enter roll number : ";
cin>>roll;
cout<<" Enter name of srudent : ";
cin>>name;
}
void student::display(){
cout<<"\n Roll No. : "<<roll;
cout<<"\n Name : "<<name;
}
class test{
int sub1,sub2;
student st;
public:
void readdata();
void putdata();
};
void test::readdata(){
st.get();
cout<<" Enter the marks of subject1 : ";
cin>>sub1;
cout<<" Enter the marks of subject2 : ";
cin>>sub2;
}
void test::putdata(){
st.display();
cout<<"\n Marks of Subject1 : "<<sub1;
cout<<"\n Marks of Subject2 : "<<sub2;
}
int main(){
test x;
x.readdata();
x.putdata();
return 0; }

You might also like