- 最後登錄
- 2023-6-30
- 在線時間
- 3 小時
- 註冊時間
- 2009-2-4
- 閱讀權限
- 70
- 精華
- 0
- UID
- 5782087
- 帖子
- 1600
- 積分
- 23884 點
- 潛水值
- 54991 米
| 所有積分大於負-100的壞孩子,將可獲得重新機會成為懲罰生,權限跟幼兒生一樣。 - using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int ans = 38;
- int guess = 0;
- guess = int.Parse(Console.ReadLine());
- Random rd = new Random();
- ans = rd.Next(1,50);
- if (guess > ans)
- {
- Console.WriteLine("太大囉");
- }
- if (guess < ans)
- {
- Console.WriteLine("太小囉");
- }
- if (guess == ans)
- {
- Console.WriteLine("答對了");
- }
- }
- }
複製代碼 發現三個錯誤~~
1.太大要用">"而不是">="
2.太小要用"<"而不是"<="
3.最後一個else要拿掉... |
|