#include <iostream>
using namespace std;
#include<string>
class student
{
private:
int roll;
string name;
float height;
float weight;
public:
student()
{
name="Nikhil";
roll=20;
height=165.5;
weight=58.2;
}
void read()
{
cin>>name>>roll>>height>>weight;
}
void display()
{
cout<<name<<" "<<roll<<" "<<height<<" "<<weight<<endl;
}
};
int main() {
student s1,s2;
s1.read();
s1.display();
s2.display();
return 0;
}
using namespace std;
#include<string>
class student
{
private:
int roll;
string name;
float height;
float weight;
public:
student()
{
name="Nikhil";
roll=20;
height=165.5;
weight=58.2;
}
void read()
{
cin>>name>>roll>>height>>weight;
}
void display()
{
cout<<name<<" "<<roll<<" "<<height<<" "<<weight<<endl;
}
};
int main() {
student s1,s2;
s1.read();
s1.display();
s2.display();
return 0;
}
#include
ReplyDeleteusing namespace std;
class student
{
public:
int roll;
string name;
float height,weight;
student()
{
name ="Bhagavan";
roll=1593;
height=172.5;
weight=60.4;
}
void readinput()
{
cin>>name;
cin>>roll;
cin>>height;
cin>>weight;
}
void displaydata()
{
cout<<name;
cout<<" "<<roll;
cout<<" "<<height;
cout<<" "<<weight<<endl;
}
} ;
int main()
{
student s1, s2;
s1.readinput();
s1.displaydata();
s2.displaydata();
return 0;
}
_Classes Functions and Constructors
Bhagavan the Inspirational Teacher