Exemple #1
0
int main()
{
	BMI Bmi;
	int i;
	float h,w,b;
	Bmi.h=170;
	Bmi.w=65;
	ifstream filein("file.in");
	ofstream fileout("file.out",ios::out);
	while(filein>>h>>w){
		if(h==0&&w==0)
			break;
		fileout<<Bmi.bmi(h,w)<<" "<<Bmi.category(h,w)<<endl;
	}
	filein.close();
	fileout.close();

	return 0;
}
Exemple #2
0
int main(){
	string data;
	ifstream fin("fin.txt",ios::in);
	ofstream fout("fout.txt",ios::out);
	int h,w;
	BMI bmi;
	while(fin>>h>>w){
		
		float bmii = 0;
		bmii=bmi.countbmi(w, bmi.hmeter(h));
		
		data=bmi.category();
		/*cout << "bmi:" << bmii << endl; 
		cout << "data" <<  data << endl;*/	

		fout<<bmii<<"/t"<<data<<endl;
	}
	return 0;
}