返回列表 發帖
  1. #include<iostream>
  2. using namespace std;

  3. int main()
  4. {  
  5.   for(int i=1;i<=9;i++){
  6.       cout << i;
  7.           if(i%2==0){
  8.               cout <<  endl ;  
  9.           }
  10.           if(i%2!=0 && i<=5){
  11.              for(int j=1;j<=i;j++){
  12.                   cout << "*" ;   
  13.              }
  14.              cout << endl;      
  15.           }  
  16.           if(i%2!=0 && i>5){
  17.            for(int k=(10-i);k>=1;k--){
  18.                    cout << "*" ;   
  19.              }
  20.              cout << endl;      
  21.           }            
  22.   }
  23.             
  24.      system("Pause");
  25.      return 0;
  26. }
複製代碼
張雅淳

TOP

返回列表