new microsoft word document

2
 #include<iostream> #include<string.h> using namespace std; class Exam { static float total; char n[20]; int r; float m;  public: Exam(){} Exam(char na[20],int ro, float ma) { strcpy(n,na); r=ro; m=ma; } friend float retotal(Exam[]); ~Exam() { cout<<r<<" is removed"<<endl; } }; float Exam::total; float retotal(Exam o[5]) { float total; int i; for(i=0;i<5;i++) { total=total+o[i].m; } return total; } main() { system("cls"); int i; Exam o[5]={Exam("barsha",1,100),Exam("barsha",2,100),Exam("barsha",3,100),Exam("barsha",4,100 ),Exam("barsha",5,100)}; cout<<"total= "<<retotal(o)<<endl; return 0; } Chat Conversation End

Upload: bineilkcthapa

Post on 06-Oct-2015

218 views

Category:

Documents


0 download

DESCRIPTION

fdg

TRANSCRIPT

  • #include #include using namespace std; class Exam { static float total; char n[20]; int r; float m; public: Exam(){} Exam(char na[20],int ro, float ma) { strcpy(n,na); r=ro; m=ma; } friend float retotal(Exam[]); ~Exam() { cout