QAQ的小遊戲 (2018 12 7)

2021-09-04 10:53:58 字數 1574 閱讀 6230

描述:

recently,qaq fell in love a small game,which simulates browser browsing web pages.it has three kind of operations:

1.back: back to the previous page

2.forward:go to the next page

3.visit url:access to the web page

now,qaq has visited and wants to know the website after each operation, if the page not change, output 「ignored」.

輸入:

there is only one test data, and the number of operations does not exceed 1000,end flag when input 「quit」

attion: every website length no more then 100.

輸出:

if the website changes, output the new website, if not, output ignored.

樣例輸入:

visit

visit

back

back

back

forward

visit

back

back

forward

forward

forward

quit

樣例輸出:

ignored

ignored

分析:

這道題大概就是一道模擬題吧,首先我們建立乙個二維陣列並且初始化第乙個位置的字串為(首頁),因為字串較長無法直接定義,所以這裡我們為了快捷選擇使用strcpy(遍歷輸入也可以,但是占用的資源太多了)然後令i為計數器,看執行的第幾步,令k來標記是前進是後退,緊接著分情況討論即可。

下面會大概說一下strcpy

strcpy(庫函式,在中)

char strcpy(a,b);

把 b所指向的字串複製到 a(用於儲存複製內容的目標陣列)中。

複製的字串含有』\0』字元

**如下:

#include#includeint main()

else if(a[0]=='b')

else printf("ignored\n");

}else if(a[0]=='f')

else printf("ignored\n");

}}return 0;

}

小遊戲製作 打氣球小遊戲

打氣球小遊戲 package private function 遊戲開始 event mouseevent void private function 複製 event timerevent public function 重新整理分值 分值 number 事件 private function 點...

字母小遊戲

時間限制 1000 ms 記憶體限制 65535 kb 難度 0 描述 給你乙個亂序的字串,裡面包含有小寫字母 a z 以及一些特殊符號,請你找出所給字串裡面所有的小寫字母的個數,拿這個數對26取餘,輸出取餘後的數字在子母表中對應的小寫字母 0對應z,1對應a,2對應b.25對應y 輸入第一行是乙個...

打字小遊戲

呵呵,這是我人生的第乙個寫的程式 打字遊戲!其實並不難 include include include include include using namespace std 隨機生成數字 大寫字母 小寫字母 char randomchar if type 1 return rand 26 a 將游...