You are on page 1of 2

// Summer_Lecture4.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <iostream>

#include "string"

using namespace std;

class result

private:

char name[20];

string subjectnames[5];

int marks[5];

public:

result()

subjectnames[0]="OOP";

subjectnames[1]="DB";

subjectnames[2]="ENG";

subjectnames[3]="DS";

subjectnames[4]="SE";

name[0]='\0';

for (int i=0; i< 5; i++)

marks[i]=0;

void setData(){

cin.ignore();

cout<<"Enter Name :";

gets_s(name);

for (int i=0;i<5;i++)

{
cout<<"Enter marks of " <<subjectnames[i]<<": ";

cin>>marks[i];

void getData(){

cout<<name<<"\t";

for(int i=0;i<5;i++)

cout<<marks[i]<<"\t";

cout<<endl;

};

void main()

result std1,std2,r3,r4,r5,r6,r7;

/*cout<<"Enter Data of Student 1: \n";

std1.setData();

cout<<"\nEnter Data of Student 2: \n";

std2.setData();*/

std1.getData();

std2.getData();

system("pause");

You might also like