Board logo

標題: 小星星 4 [打印本頁]

作者: 鄭又綸    時間: 3 天前 16:12     標題: 小星星 4

本帖最後由 鄭又綸 於 2025-4-17 19:21 編輯

利用巢狀迴圈, 試做一個長為10顆*, 高為4顆*, 之平行四邊形, 排列如下圖:
[attach]20933[/attach]
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     for(____________)
  7.     {
  8.           for(____________)
  9.           {
  10.               cout<<" ";
  11.           }
  12.           for(____________)
  13.           {
  14.               cout<<"*";
  15.           }
  16.           cout<<endl;      
  17.     }
  18.     system("pause");
  19.     return 0;
  20. }
複製代碼
本帖隱藏的內容需要回復才可以瀏覽

作者: 陳宥廷    時間: 3 天前 19:28

此帖僅作者可見
作者: 李岱哲    時間: 3 天前 19:28

此帖僅作者可見




歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2