小胖 發問時間: 電腦與網際網路程式設計 · 1 0 年前

請幫我看看計算機概論理有關c++的問題,

Write the body of ac++ main function that that gets the length and width of a rectangle from the user and computes and writes out the area. Assume that the variables have all been declared.

1 個解答

評分
  • 1 0 年前
    最佳解答

    寫一個 C++ 的主函式,必須從使用者取得矩形的長度和寬度,然後計算並顯示面積。假定變數皆已宣告。

    //Power by Visual Studio 2005

    #include<iostream>

    #include<cstdlib>

    using namespace std;

    int main(int argc, char** argv)

    {

    //==========START==========//

    double length,width;

    cout<<"Input length= ",cin>>length;

    cout<<"Input width= ",cin>>width;

    cout<<"The Area of Rectangle= "<<length*width<<endl;

    //==========END==========//

    system("PAUSE");

    return EXIT_SUCCESS;

    }

還有問題?馬上發問,尋求解答。