You are on page 1of 4

#include<iostream>

#include<conio.h>

using namespace std;

struct student
{
char name[30];
float cgpa;
char enroll[20];
char uni_name[30];

void input()
{
cout << "Enter Name of Student : ";
cin >> name;
cout << "Enter cgpa Student : ";
cin >> cgpa;
cout << "Enter ROLL# of Student : ";
cin >> enroll;
cout << "Enter UNIVERSITY of Student : ";
cin >> uni_name;
}

void display()
{
cout << "NAME : " << name << endl;
cout << "CGPA : " << cgpa << endl;
cout << "ROLL# : " << enroll << endl;
cout << "UNIVERSITY : " << uni_name << endl;
}

};
int main()
{
student obj[5];
for (int i = 0; i < 5; i++)
{
obj[i]. input();
obj[i].display();

_getch();
}

#include<iostream>
#include<conio.h>

using namespace std;

struct student
{
char name[30];
float cgpa;
char enroll[20];
char uni_name[30];

void input()
{
cout << "Enter Name of Student : ";
cin >> name;
cout << "Enter cgpa Student : ";
cin >> cgpa;
cout << "Enter ROLL# of Student : ";
cin >> enroll;
cout << "Enter UNIVERSITY of Student : ";
cin >> uni_name;
}

void display()
{
cout << "NAME : " << name << endl;
cout << "CGPA : " << cgpa << endl;
cout << "ROLL# : " << enroll << endl;
cout << "UNIVERSITY : " << uni_name << endl;
}

};
int main()
{
student obj[5];
student* p;
p = obj;
for (int i = 0; i < 5; i++)
{
p[i]. input();
p[i].display();

_getch();
}

#include<iostream>
#include<conio.h>

using namespace std;

struct student
{
char name[30];
float cgpa;
char enroll[20];
char uni_name[30];

void input()
{
cout << "Enter Name of Student : ";
cin >> name;
cout << "Enter cgpa Student : ";
cin >> cgpa;
cout << "Enter ROLL# of Student : ";
cin >> enroll;
cout << "Enter UNIVERSITY of Student : ";
cin >> uni_name;
}

void display()
{
cout << "NAME : " << name << endl;
cout << "CGPA : " << cgpa << endl;
cout << "ROLL# : " << enroll << endl;
cout << "UNIVERSITY : " << uni_name << endl;
}

};
int main()
{
student obj[5];
student* p;
p = obj;
for (int i = 0; i < 5; i++)
{
(*(p+i)).input ();
p->display();

_getch();
}

#include<iostream>
#include<conio.h>

using namespace std;

struct student
{
private:
char name[30];
float cgpa;
char enroll[20];
char uni_name[30];
public:

void input()
{
cout << "Enter Name of Student : ";
cin >> name;
cout << "Enter cgpa Student : ";
cin >> cgpa;
cout << "Enter ROLL# of Student : ";
cin >> enroll;
cout << "Enter UNIVERSITY of Student : ";
cin >> uni_name;
}

void display()
{
cout << "NAME : " << name << endl;
cout << "CGPA : " << cgpa << endl;
cout << "ROLL# : " << enroll << endl;
cout << "UNIVERSITY : " << uni_name << endl;
}

};
int main()
{
student obj[5];
student* p;
p = obj;
for (int i = 0; i < 5; i++)
{
(p+i)->input();
(p+i)->display();

_getch();
}

You might also like