![]() |
|
論壇說明 | 標記討論區已讀 |
歡迎您來到『史萊姆論壇』 ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』 |
![]() ![]() |
|
主題工具 | 顯示模式 |
![]() |
#1 |
註冊會員
|
![]() 以前常玩的猜字母遊戲@@
老師會話一個人上吊的圖~~~ 然後26個字母 去猜一個單子~~~ 不過要寫程一個遊戲 我覺得好難阿 ![]() 誰可以幫幫我 ![]() 1.The computer randomly selects an English word from a list of at least 10 English words. 2.The computer randomly exposes some characters of an English word of the lenght n. At least 1 character is exposed and at maximum n - 1 character. 3.The player guesses character by character until the word is solved or the 8 times of wrong guesses is exceeded. 4.Each time a correct character is guessed the character is exposed. 5.They player can decide to continue to play or not. Hint: 1.To get the string length, use the strlen function. 2.To compare two strings, use the strcmp function. 3.To count the number of strings, refer to the following code: main() { char *words[] = {"computer", "information", "engineering", "programming"}; char guess[30]; int i, n = sizeof(words)/sizeof(char *); printf("List of string: "); for (i = 0; i < n; i++) printf("%s ", words[i]); i = rand() % n; printf("\nEnter your guess : "); scanf("%s", guess); printf("Your guess is \"%s\".\n", guess); printf("Computer selects \"%s\".\n", words[i]); if (strcmp(guess, words[i])) printf("Your guess is wrong.\n"); else printf("Your guess is correct.\n"); } A possible session could look like as follows: The word to guess: -a--c Your guess => o The word to guess: -a--c Your guess => m The word to guess: ma--c Your guess => l The word to guess: ma--c Your guess => g The word to guess: mag-c Your guess => i Correct! The word is magic. ==================================================== Continue (Y/N)? Y The word to guess: wo--e- ... ... You guessed wrong more than 8 times. The word is wonder. ==================================================== Continue (Y/N)? N Bye! 拜託一下了 ![]() |
![]() |
送花文章: 5,
![]() |
![]() ![]() |
主題工具 | |
顯示模式 | |
|
|
![]() |
||||
主題 | 主題作者 | 討論區 | 回覆 | 最後發表 |
英文板的 XP如何使用中文軟體(繁體) | kohoku | 軟體應用問題討論區 | 2 | 2003-05-11 01:37 PM |
Ghost 這一個程式該如何使用 | 電腦狂 | 軟體應用問題討論區 | 2 | 2003-02-07 06:26 AM |
請問如何使用Alcohol 120% 製作虛擬光碟來玩遊戲? | I am Jerry | 一般電腦疑難討論區 | 4 | 2003-02-02 11:31 PM |
請問如何使用DiscJuggler備份PS遊戲片 | sis6326 | 軟體應用問題討論區 | 0 | 2002-12-21 06:54 PM |