用c語言寫出*三角形

怎樣利用for來寫 ??

成日都想不到

*

***

*****

********

很急!!

現在就要!!

拜託ㄌ!!

個位大大

2 Answers

Rating
  • 1 decade ago
    Favorite Answer

    #include <cstdlib>

    #include <iostream>

    using namespace std;

    int hight;

    int main(int argc, char *argv[]){

    cout<<"請輸入層數"<<endl;

    cin>>hight;

    for(int i=1;i<=hight;i++){

    for(int j=1;j<=(2*i-1);j++){

    cout<<"*";

    }

    cout<<endl;}

    system("PAUSE");

    return EXIT_SUCCESS;

    }

    2009-10-26 00:48:27 補充:

    忘記會變亂碼

    給你我網路空間:http://webo.com.hk/tim093309

    檔案仔點http://webo.com.hk/download.php?i=215713

    Source(s): Me
  • 1 decade ago

    我覺得你回答會更不懂吧 你用*那他還沒學*,不是又會有疑問?

    http://webhd.mcu.edu.tw/

    群組打:6789

    2009-10-26 01:03:26 補充:

    1 3 5 8 這規律怪怪的ㄝ........你確定不是1 3 5 7?

Still have questions? Get your answers by asking now.