close

//---------------------------------------------------------------------------
/****************************************************************************
練習5-3:寫一個程式可以輸入四方形的寬和高後,求出其周長。                   *
         周長 = 2 * ( 寬 + 高 )                                             *
****************************************************************************/
#include <iostream>

//---------------------------------------------------------------------------
float width;
float height;

int main(int argc, char* argv[])
{
        std::cout << "Enter the width and height of quadrangularly in a row:";
        std::cin >> width >> height;
        std::cout << "The quadrangularly's circumference is:"
                  << 2 * ( width + height ) << '\n';
        std::system("pause");
        return 0;
}
//---------------------------------------------------------------------------


題目來源:C++風格與藝術 第二版 Steve Oualline 著 黃吉霈 編譯
答案來源:自我撰寫(不保證正確喔)

arrow
arrow
    全站熱搜

    jumbowind 發表在 痞客邦 留言(0) 人氣()