パスワードを忘れた? アカウント作成
649907 journal

YuAokiの日記: BMIを計測する(C++版)

日記 by YuAoki
#include <iostream>
using namespace std;

class Bmi
{
public:
int height;
int weight;
double calculate(int t_height,int t_weight);
double calculate();
};

double Bmi::calculate(int t_height,int t_weight)
{
double t2_height = (double) t_height/100;
return (double ) t_weight / t2_height / t2_height;
}

double Bmi::calculate()
{
Bmi* bmi;
return bmi->calculate(height,weight);
}

int main(int argc, char *argv[])
{
  int I_height;
  int I_weight;
  cout << "BMIの値を計測しましょうか"<< endl;
  cout << "身長は(単位cm)"<< endl;
  cin >> I_height;
  cout << "体重は(単位kg)"<< endl;
  cin >> I_weight;
  Bmi bmi;
  bmi.height=I_height;
  bmi.weight=I_weight;
  double bmiShow = bmi.calculate();
  cout << bmiShow << endl;
  system("PAUSE");
  return 0;
}
この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
typodupeerror

犯人は巨人ファンでA型で眼鏡をかけている -- あるハッカー

読み込み中...