正在加载图片...
Slide 9 Example: algorithm int row, space, stari int row i row=l; row=1 while(row=5)i while(row<=5) space=li while(space<=5-row)( 5-row spaces cout < 2*row-1 starsi space=space+li row=row+l; star= while(star<=2*row-1) cout < l* star=star+1 cout < endl row=row+1Slide 9 Example: algorithm int row, space, star; row=1; while(row<=5){ space=1; while(space<=5-row) { cout << " "; space=space+1; } star=1; while(star<=2*row-1) { cout << "*"; star=star+1; } cout << endl ; row=row+1; } int row; row=1; while(row<=5){ 5-row spaces; 2*row-1 stars; row=row+1; }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有