Define a structure of student class, C/C++ Programming

Assignment Help:

Define a structure of student class: 

Write a program to define a structure of student record in C.

class student

{

char name[20];

int roll_no;

int marks[2];

float average;

 

public:

 void input();

 void output();

 float calci();

 friend  void rank(student ,student );

 };

 

 void student:: input()

 {

 cout << "enter the name ,rollno,marks of 2 subjects\n";

 cin>> name >> roll_no >>marks[0]>>marks[1];

 }

 

 void student :: output()

 {

 cout<

 }

 

 float  student :: calci()

 {

return average= float(marks[0]+ marks[1]) / 2;

 }

 

 void rank(student a, student b)

     {

                if ( a.calci() > b.calci() )

 

                 cout << "the student e1 is best\n";

 

                 else

 

                 cout <<"the studentr e2 is best\n";

 

     }

 

 void main()

 {

 

 clrscr();

 student t[2];

 t[0].input();

// t[0].calci();

// t[0].output();

 

 

 t[1].input();

// t[0].calci();

 //t[1].output();

 

 rank(t[0],t[1]);

 getch();

 

 }


Related Discussions:- Define a structure of student class

Should i employ null or 0?, A: In C++, the definition of NULL is 0, thus th...

A: In C++, the definition of NULL is 0, thus there is only an aesthetic difference. I prefer to ignore macros, so I employ 0. Another difficulty with NULL is that people sometimes

C programming, write a c program to solve exanple of lamis therom

write a c program to solve exanple of lamis therom

Write a program that illustrate union declaration, Write a Program that ill...

Write a Program that illustrate union declaration? A C program encloses the following union declaration: union id { char color[12]; int size; } shirt, blouse; At this

Create complex number using constructor , Create Complex number using const...

Create Complex number using constructor: class complex                                 {                                                   private:

ARRAY, A PROGRAM TO CALCULATE AREA OF TRIANGLE

A PROGRAM TO CALCULATE AREA OF TRIANGLE

Visual c++, i want write visuaL c++ FOR MY ALGORITHM

i want write visuaL c++ FOR MY ALGORITHM

Wap for basic salary of employees & calculate net salary, WAP TO ACCEPT THE...

WAP TO ACCEPT THE BASIC SALARY OF EMPLOYEES & CALCULATE NET SALARY   #include stdio.h> #include conio.h>   void main() {                    float Basi

Decode the code, Smugglers are becoming very smart day by day. Now they hav...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Do i have to check for null after p = new fred()?, A: No. (Excluding if you...

A: No. (Excluding if you have an old compiler, you might have to force the new operator to throw an exception if it runs out of memory.) This turns out to be a real pain to alwa

How private instance of a class can be assigned values, Question 1: (a)...

Question 1: (a) Explain clearly the following concepts using suitable examples of your own:- (i) concrete class v/s abstract class (ii) constructor v/s over

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd