討論串[問題] 打星號畫圖
共 12 篇文章
首頁
上一頁
1
2
3
下一頁
尾頁

推噓3(3推 0噓 5→)留言8則,0人參與, 最新作者tokyobabylon (paris)時間14年前 (2009/11/03 22:52), 編輯資訊
2
0
0
內容預覽:
今天遇到一題在螢幕上show星號畫圖的問題. *. **. ***. 一般是使用兩個迴圈.... for(int i=1; i<n;i++). fot(int j=1; j<=i;j++). cout<<"*";. 但今天的題目是"限定只能用一個迴圈". so 單就這題來說是想到. #include
(還有256個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者willy7954 (乖乖)時間14年前 (2009/11/03 23:49), 編輯資訊
0
0
0
內容預覽:
#include <iostream>. #include <cstring>. using namespace std;. int main(){. string s("*");. for(int i=0;i<3;i++){. cout << s << endl;. s.push_back('*'

推噓4(4推 0噓 1→)留言5則,0人參與, 最新作者adrianshum (Alien)時間14年前 (2009/11/04 11:31), 編輯資訊
0
0
0
內容預覽:
你當是 psuedo code 看好了 :P. char * LONG_STAR_STRING = new char[n+1];. memset(LONG_STAR_STRING, '*');. LONG_STAR_STRING[n] = '\0';. for (i = 0; i < n; i++)
(還有154個字)

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者OpenBigJue (開大決)時間14年前 (2009/11/04 13:29), 編輯資訊
0
0
0
內容預覽:
這要考的應該是一維陣列表示二維圖形的方法 @Q@. const int num = 3;. for(int i=0; i<num*num; ++i). {. if( i/num >= i%num ). printf("*");. else. printf(" ");. if( i%num == nu
(還有222個字)

推噓7(7推 0噓 1→)留言8則,0人參與, 最新作者ccpz (OoOoOo)時間14年前 (2009/11/04 13:43), 編輯資訊
0
0
0
內容預覽:
#include <stdio.h>. int main(). {. int i=0;. for(i=1;i<=10;i++). printf("%.*s\n", i, "****************");. return 0;. }. --. #1Ade1pyY (Baseball). --.
首頁
上一頁
1
2
3
下一頁
尾頁