本帖最後由 goodbye_mylove 於 2011-10-27 01:15 AM 編輯
- #include<cstdlib>
- #include <iostream>
- using namespace std;
- int main(int argc, char *argv[])
- {
- int a,b,c,d,e;
- cout<<"輸入的第1-5個數字"<<endl;
- cin>>a>>b>>c>>d>>e;
- cout<<"輸出的第1個圖案為 "<<endl;
- for(int i=1;i<=a;i++){
- cout<<"*";
- }
- cout<<endl;
- cout<<"輸出的第2個圖案為 "<<endl;
- for(int i=1;i<=b;i++){
- cout<<"*";
- }
- cout<<endl;
- cout<<"輸出的第3個圖案為 "<<endl;
- for(int i=1;i<=c;i++){
- cout<<"*";
- }
- cout<<endl;
- cout<<"輸出的第4個圖案為 "<<endl;
- for(int i=1;i<=d;i++){
- cout<<"*";
- }
- cout<<endl;
- cout<<"輸出的第5個圖案為 "<<endl;
- for(int i=1;i<=e;i++){
- cout<<"*";
- }
- cout<<endl;
- system("pause");
- return 0;
- }
複製代碼
... |