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

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;



 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()





 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";




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




 void main()




 student t[2];


// t[0].calci();

// t[0].output();




// t[0].calci();







Posted Date: 10/19/2012 3:08:46 AM | Location : United States

Related Discussions:- Define a structure of student class, Assignment Help, Ask Question on Define a structure of student class, Get Answer, Expert's Help, Define a structure of student class Discussions

Write discussion on Define a structure of student class
Your posts are moderated
Related Questions
Explain Processing A Data File? Mainly data file applications needs that a data file be altered as it is being processed. For instance in an application involving the processin

#question.College life is tough. Eating pizza for every meal is hitting you hard. You are looking at working out to stay healthy. You found a web site that tells you how many ca

Control Flow The control flow statements are used when it is needed that the flow of the program is to be changed after taking some decision. This control flow statement theref

one of the applications of computers in numerical analysis is computing the area under a curve. one method of calculating the area under acurve is to divide the area int a number o

This problem familiarizes you with using random numbers in C++. The program is to compute a good approximation of π using a simulation method called "Monte Carlo". The following fi

Write a Program to illustrate the Call by Reference? Here is an illustration: #include . int compute_sum(int *n); int main( void) { int n=3, sum; printf("%d\n",n); /

explain Storage management: free storage pool, garbage collection, compaction, boundary tag method; Hash tables and hashing functions