私はkgで私の体重を入力すると私に石のための正しい出力を与えるが、私のポンドの重量はオフです。kgから石とポンドに変換するとき
仮定する2.2ポンドその石であなた重みを与えるとポンドの小数点する石
想定されキロ と14lbsで、私の石は良いのですが、ポンドはHERESに道オフスクリプト
任意のヘルプです#include <iostream>
using namespace std;
//declarations
const float LBS_PER_KG=2.2;
const float LBS_PER_STONE=14;
const float STONE_PER_KG=6.36;
int main()
{
float weightInKG;
float weightInSTONE;
float weightInLBS;
cout <<"enter a measurement in Kilograms";
cin >> weightInKG;
weightInSTONE = static_cast<int>(weightInSTONE*LBS_PER_KG/LBS_PER_STONE);
weightInSTONE = weightInKG/STONE_PER_KG;
weightInLBS = weightInKG/LBS_PER_KG;
cout <<weightInKG<<"KG = "<<weightInSTONE<<"Stones and"
<<weightInLBS<<"Pounds";
cout <<endl;
return 0;
}
希望の出力と実際の出力の例を挙げてください。 – Neo
C++プログラムはスクリプトではありません。 –
出石は7石と7ポンドでなければなりません。イムは7.53石と7.53ポンドを得ています。 – Colton