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;

 

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

 

 }

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
Jewels can only be removed for polishing from either end of the necklace

I have a very confusing assignment and I''m struggling to find the right place to begin or how to break the problem down.

Rahul is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''{'' and end with '

Memory Management Operator In C malloc( ), calloc( ), realloc( ), and free( ) are used to mange dynamic memory.  In addition to these function C++ have derived two unary ope

write a program that counts the number of occurences of the string in the n-th Padovan string P(n) program in java // aakash , suraj , prem sasi kumar kamaraj college progr

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.   #include float start_poin

A: In C++ a struct is alike to a class except for the default access specifier( refer to other question in the document). In C we ought to include the struct keyword while declarin

Define Bitwise-Shift Operators? The shift operators perform suitable shift by operator on the right to the operator on the left. The right operator should be positive. The va

Make the following 3 functions work by filling in appropriate C code. This file 1. // Write a function to count the number of particular characters in a string. // Do not use a

what is virtual datatype