c++ program to find mean of two number

c++ program to find mean of two number

#include <iostream>
using namespace std;
class mean
{
  private:
  int a;
  int b;
  friend float avg(mean&m1);
  public:
  void get()
  {
    cin>>a>>b;
  }
};
float avg(mean&m1)
{
  return((m1.a+m1.b)/2);
}
int main()
{
  mean m1;
  m1.get();
  cout<<"mean is:"<< avg(m1);
}

Output:



Related Posts:

0 comments: