cout&cin

Q:求BMI

#include <cstdlib>
#include <iostream>
#include <cmath>

using namespace std;

int main(int argc, char *argv[])
{
float weight;
float height;
cout << "請輸入體重:";
cin >> weight;
cout << "請輸入身高:";
cin >> height;
float bmi = weight / pow(height, 2);
cout << "bmi = " << bmi << " 公斤/平方公尺\n";
    
system("PAUSE");
        return EXIT_SUCCESS;
}

這個網誌中的熱門文章

使用memset加快二維陣列初始

TCGS b004: 一個都不能少

UVA Q591:Box of Bricks