/*
Default Constructor
Accepting the value from user
*/
#include<iostream>
using namespace std;
class Student
{
int rollno;
char name[20];
public:
Student()
{
cout<<"\n\n Enter Rollno and Name: ";
cin>>rollno>>name;
}
void display()
{
cout<<"\n\n Rollno: "<<rollno;
cout<<"\n\n Name: "<<name;
}
};
int main()
{
Student s;
s.display();
return 0;
}
Default Constructor
Accepting the value from user
*/
#include<iostream>
using namespace std;
class Student
{
int rollno;
char name[20];
public:
Student()
{
cout<<"\n\n Enter Rollno and Name: ";
cin>>rollno>>name;
}
void display()
{
cout<<"\n\n Rollno: "<<rollno;
cout<<"\n\n Name: "<<name;
}
};
int main()
{
Student s;
s.display();
return 0;
}