引用 | 編輯
chpo
2009-04-30 12:06 |
樓主
▼ |
||
x0
1.如何將下列程式輸出如圖形1 22 333 4444 55555 程式碼: 1 #include< > 2 #include< > 3 void main() 4 {int i=_______________,j; 5 do 6 {cout.width(___________); 7 j=________________; 8 do 9 {cout <<__________; 10 _______________; 11 .. 訪客只能看到部份內容,免費 加入會員 x0
|
引用 | 編輯
leacks
2009-05-06 23:34 |
1樓
▲ ▼ |
應該又是相傳中的學校作業
下面的題目應該不只那些吧 而且getch是啥阿 第一題非常簡單 #include "stdafx.h" #include "iostream" #include "stdlib.h" #include "time.h" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) cout<<i; cout<<"\n"; } system("pause"); return 0; } 當然你要改while也可以,範例都給你了 基本上這是for的題目,所以你們老師應該有先出for的題目 x0 |
引用 | 編輯
teldeanmac85
2009-05-08 13:35 |
2樓
▲ |
#include <iostream.h>
#include <conio.h> void main() { int i= 1 ,j; do{ cout.width(1); j=1; do{ cout <<j; j++; } while (j<=i); cout<< endl; i++; }while (i<=5); getch(); } chpo : 我覺得你應該需要這些答案吧 加油囉 ~ leacks : getch()與getchar()大同小異 但是getch()必須include conio.h x0 |