返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.         int a=0;
  7.         cout<<"the height of the triangle : ";
  8.         cin>>a;
  9.         for(int b=a;b>0;b--)
  10.         {
  11.                 for(int c=0;c<b;c++)
  12.                 {
  13.                         cout<<" ";
  14.                 }
  15.                 for(float d=a;d>=b;d-=0.5)
  16.                 {
  17.                         cout<<"*";
  18.                 }
  19.                 cout<<"\n";
  20.         }
  21.         system("pause");
  22.         return 0;
  23. }
複製代碼

TOP

返回列表