07/12/10 22:13:26
>>643
#include <iostream>
using namespace std;
class phdata{
private:
double height, weight;
public:
phdata(double height, double weight);
operator double();
};
phdata::phdata(double height, double weight){
this->height = height;
this->weight = weight;
}
phdata::operator double(){
return weight*10000/(height*height);
}
int main(){
phdata data(172.5, 75.4);
cout << "BMI:" << (double)data << endl;
return 0;
}