Sample

Muthumari_B · updated September 03, 2021 · C++
#include <iostream>
using namespace std;
class sample 
 {
 int a,b;
 public:
 void setvalue()
 {
   a=25;
   b=40;
 }
 friend float mean(sample s);
 };
 float mean(sample s)
 {
 return(s.a+s.b)/2.0;
 }
 main()
 {
 sample x;
 x.setvalue();
 cout<<"mean value"<<mean(x);
 }
    

Comments

Please sign up or log in to contribute to the discussion.