Computer Science, asked by rahulkgupta0101, 6 months ago

Create a class Student which has data members as name, branch, roll no, age ,sex ,marks in five subjects. Display the name of the student and his percentage who has more than 70%.Use array of objects

Answers

Answered by arya09354601363
8

Answer:

9oolookildnviebcub3cuv3fy3f

Answered by zaabedeen10
0

Answer:

#include<iostream>

using namespace std;

class student

{

private:

char name[30],branch[25],sex[10];

int age,roll,m1,m2,m3,m4,m5;

public:

int p;

void get()

{

cout<<"Enter name : ";

cin>>name;

cout<<"Enter branch : ";

cin>>branch;

cout<<"Enter sex : ";

cin>>sex;

cout<<"Enter age : ";

cin>>age;

cout<<"Enter roll no. : ";\

cin>>roll;

cout<<"Enter marks of 5 subjects : ";

cin>>m1>>m2>>m3>>m4>>m5;

p=(m1+m2+m3+m4+m5)*100/500;

}

void print()

{

if(p>70)

{

cout<<"Name is : "<<name<<endl;

cout<<"Roll no is : "<<roll<<endl;

}

}

};

int main()

{

student s[100];

int n,i;

cout<<"Enter the number of students : ";

cin>>n;

for(i=0;i<n;i++)

{

s[i].get();

}

for(i=0;i<n;i++)

{

s[i].print();

}

return 0;

}

Explanation:

we have used array of objects here, and all tje explanation is there in program, as it is so easy to understand.

Similar questions