C++ program to display the name, height, weight, Roll no, of student

 C++ program to display the name, height, weight, Roll no, of student


#include <iostream>  

using namespace std;  

class student{  

private:  

string name;  

int  rollNo,height,weight;  

public:  

student(string n,int r,int h,int w){  

name=n;  

rollNo=r;  

height=h;  

weight=w;  

}  

void display(void);  

~student();  

};  

void student::display(void){  

        cout <<"Student details:\n";  

        cout <<"Name of student:        "<< name<<endl <<"Roll Number of student: "<< rollNo <<endl;  

cout<<"Height of student:      "<< height <<endl<<"Weight of student:      "<< weight<<endl;  

}  

student :: ~student(){  

cout<<endl<<"";  

int main(){  

student con("Rohan",2,120.0,80);                   

student con1=con;  

con1.display();  

return 0; 





For Flipkart and Amazon best deals visit:



No comments:

Powered by Blogger.