Advertisements
Advertisements
प्रश्न
Implement a class average that accepts. value of three float variables another function print() average of three numbers.
कोड लेखन
Advertisements
उत्तर
#include <iostream.h>
class average
{
private
float a, b, c, s;
Public:
average()
{
cout<<"Enter 3 nos.";
cin>>a>>b>>c;
}
void cal()
{
s = (a + b + c)/3;
}
void print()
{
cout<<"average="<<s;
}
~average() { }
};
void main()
{
average ob;
ob.cal();
ob.print();
}shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
