為甚麼代碼錯(cuò)誤
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? int[] score = { 85,76,98,100,62,60};//分?jǐn)?shù)
? ? ? ? ? ? for (int i = 0; i < score.Length; i++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? if (score[i] < 60)//如果有不及格的
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? int x;//記錄有不及格的
? ? ? ? ? ? ? ? ? ? x=score[i];
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? ? ? if (x>0)
? ? ? ? ? ? ? ? Console.WriteLine("有人不及格");
? ? ? ? ? ? else
? ? ? ? ? ? ? ? Console.WriteLine("都及格啦!");
? ? ? ? }
? ? }
}
2021-12-15