Wednesday, October 19, 2011

Program:To illustrate the use of array in classes




Illustrate the concept of  arrays in classes.
CODE:

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
class ece
{
int marks;
int  rn;
char name[30];
public :
void  get()
{
cout<<"Enter roll no. of student";
cin >>rn;
cout<<"Enter name of student";
gets(name);
cout<<"Enter the marks" ;
cin>>marks;
}
void show()
{
cout<<"\nname of student  ";
puts(name);
cout<<"\nroll no. of student  ";
cout<<rn;
cout<<"\nmarks of the student  ";
cout<<marks;
}
};
void main()
{
ece obj1;
obj1.get();
obj1.show();
getch();
}

Article by
Chief-Editor

He is a tech Enthusiast, an Altruist and calm mentor. He loves to code. He is also a creative graphic designer. Do check out his designfolio @ Jasmeet.asia If you like This post, you can follow me on Twitter.



For Further Reading,
C++ Program

0 comments:

Post a Comment