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

New Microsoft Word Document

Embed Size (px)

DESCRIPTION

fdg

Citation preview

  • #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