using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
? ? class Program
? ? {
? ? ? ? static void Main(string[] args)
? ? ? ? {
? ? ? ? ? ? try{
? ? ? ? ? ? ? ? Console.WriteLine("請輸入10個數(shù)");
? ? ? ? ? ? int[]nums=new int[10];
? ? ? ? ? ? int[] counts = new int[4];
? ? ? ? ? ? ? ? for(int i=0;i<nums.Length;i++)
? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? Console.Write("請輸入第{0}個數(shù)",i+1);
? ? ? ? ? ? ? ? ? ? nums[i]=Convert.ToInt32(Console.ReadLine());
? ? ? ? ? ? ? ? ? ? switch (nums[i])
? ? ? ? ? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ? ? case 1:
? ? ? ? ? ? ? ? ? ? ? ? ? ? counts[0] += 1;
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? case 2:
? ? ? ? ? ? ? ? ? ? ? ? ? ? counts[1] += 1;
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? case 3:
? ? ? ? ? ? ? ? ? ? ? ? ? ? counts[2] += 1;
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? ? ? default:
? ? ? ? ? ? ? ? ? ? ? ? ? ? counts[3] += 1;
? ? ? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? Console.WriteLine("數(shù)字1的個數(shù):{0}", counts[0]);
? ? ? ? ? ? ? ? Console.WriteLine("數(shù)字2的個數(shù):{0}", counts[1]);
? ? ? ? ? ? ? ? Console.WriteLine("數(shù)字3的個數(shù):{0}", counts[2]);
? ? ? ? ? ? ? ? Console.WriteLine("非法數(shù)字的個數(shù):{0}", counts[3]);
? ? ? ? }
? ? ? ? ? ? catch
? ? ? ? ? ? {
? ? ? ? Console.WriteLine("您輸入的程序錯誤");
? ? ? ? ? ? }
? ? ? ? ? ? Console.ReadKey();
? ? ? ? ? ? }
? ? }
}
