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

Need discrete math tutor, Project Description: I will need a tutor that ...

Project Description: I will need a tutor that would help me out in Data Structure and learning Algorithm more at the mathematical/algorithmic level. The book is written by "by T

C program for total & average in the array , C Program for TOTAL  & AVERA...

C Program for TOTAL  & AVERAGE IN THE ARRAY  #include stdio.h> #include conio.h> #include string.h> void main() {           int i=0,n[100],limit=0,a=0;

Area Under Curve, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Optimize and profile a c++ library for speed, Optimize and Profile a C++ li...

Optimize and Profile a C++ library for speed Project Description:  Optimize and Profile an existing C++ library for speed. This library uses OpenMP and OpenCV and C++ stan

Pebble merchant problem, There is a pebble merchant. He sells the pebbles, ...

There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that

Minimumshelf, Write a program that finds the minimum total number of shelve...

Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

Create three classes program in cpp, In this worksheet you are asked to wri...

In this worksheet you are asked to write three classes in C++: Lecture class, Course class and University class. The classes relate to each other in the way that a Course has many

Objects., what are objects or simply define objects

what are objects or simply define objects

I need cryengine sandbox speedometer and tachometer, I need Cryengine Sandb...

I need Cryengine Sandbox Speedometer and Tachometer We want to get working Tachometer and Speedometer for a car in latest Cryengine Sandbox. You will find how to make it usin

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