#include <iostream.h>
#include <conio.h>
#include <string.h>
class student
{
int roll;
char name[20];
public:
void get(int roll,char name[])
{
this->roll=roll;
strcpy(this->name,name);
}
void display()
{
cout<<"\n\nRoll No. : "<<roll;
cout<<"\nName : "<<name;
}
};
void main()
{
clrscr();
student s1;
int roll;
char name[20];
cout<<"\nEnter student roll no. : ";
cin>>roll;
cout<<"Enter student name : ";
cin>>name;
s1.get(roll,name);
s1.display();
getch();
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.