- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int speed,tmp;
- cout<<"請輸入廣告刊版的出現倍率:";
- cin>>speed;
- for(int i=1;i<=120*speed;i++)
- {
- tmp=i/speed;
- if(tmp>=1 && tmp<=10)
- {
- cout<<"歡";
- }
- if(tmp>=11 && tmp<=20)
- {
- cout<<" 光";
- }
- if(tmp>=21 && tmp<=30)
- {
- cout<<" 光";
- }
- if(tmp>=31 && tmp<=40)
- {
- cout<<" 臨";
- }
- if(tmp>=41 && tmp<=50)
- {
- cout<<"歡";
- }
- if(tmp>=51 && tmp<=60)
- {
- cout<<"歡迎";
- } if(tmp>=61 && tmp<=70)
- {
- cout<<"歡迎光";
- }
- if(tmp>=71 && tmp<=80)
- {
- cout<<"歡迎光臨";
- }
- if(tmp>=81 && tmp<=90)
- {
- cout<<" ";
- }
- if(tmp>=91 && tmp<=100)
- {
- cout<<"歡迎光臨";
- }
- if(tmp>=101 && tmp<=110)
- {
- cout<<" ";
- }
- if(tmp>=111 && tmp<=120)
- {
- cout<<"歡迎光臨";
- }
- system("cls");
- }
- system("pause");
- return 0;
- }
複製代碼 |