#include<iostream>
using namespace std;
class student
{
private:
char name[20];
int roll;
public:
student(char b[20] , int s)
{
name[20]=b[20];
roll=s;
}
int set()
{
cout<<“enter the name”<<endl;
gets(name);
cout<<“enter the roll”<<endl;
cin>>roll;
}
int get()
{
cout<<“name is: “<<name<<endl;
cout<<“roll is: “<<roll<<endl;
}
};
int main()
{
student std(“shahroz”,49);
std.set();
std.get();
system(“pause”);
}
using namespace std;
class student
{
private:
char name[20];
int roll;
public:
student(char b[20] , int s)
{
name[20]=b[20];
roll=s;
}
int set()
{
cout<<“enter the name”<<endl;
gets(name);
cout<<“enter the roll”<<endl;
cin>>roll;
}
int get()
{
cout<<“name is: “<<name<<endl;
cout<<“roll is: “<<roll<<endl;
}
};
int main()
{
student std(“shahroz”,49);
std.set();
std.get();
system(“pause”);
}
No comments:
Post a Comment