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
Defines the entry point for the console application. // #include "stdafx.h" #include #include #include"conio.h" using namespace std; double Determinant(double a[][3],int forde

Explain what are Unions? The Unions like as structures, contain members whose individual data types may perhaps differ from one another. Though the members that create a union

Explain the For Loop - Computer Programming? Similar to the while statement, for loop is an entry controlled loop and the code of the for loop will be executed itereatively. Th

void main() { int *p, *q, i ; p=(int*)100; q=(int*)200; i=q-p; printf("%d",i); } }

Important Note: No course works, which have been submitted via hard copies or emails, will be accepted a short essay below edited in a document (word, other) files with

The digital signal is one which only consists of two states i.e. logic '1'   (+5 volts) and logic '0' (0 volts). Various electronic blocks use logic and these form the basis of a m

Write a Program to illustrate Array? int x[100]; char text[80]; float temp[30]; static int marks[5]; We are able to use symbolic constants instead of expression. The valu

please provide me the assignment help. What is the difference between a copy constructor and an overloaded assignment operator?

For Loop with inner loop

After p = new Fred[n], how does the compiler know about n objects to be destructed throughout delete[] p? A:  The run-time system hold the number of objects, n, somewhere where