1. 程式人生 > >深入.NET平臺和C#程式設計 第二章上機練習1

深入.NET平臺和C#程式設計 第二章上機練習1

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Day_02上機練習
{
    class Program
    {
        static void Main(string[] args)
        {
            //上機練習1
            int[] points = new int[5];
            int[] newpoints = new int[5];
            Console.WriteLine("請輸入五位會員的積分");
            for (int i = 0; i < points.Length; i++)
            {
                Console.Write("第" + (i + 1) + "位會員積分:");
                points[i] = Convert.ToInt32(Console.ReadLine());
            }
            //陣列複製
            for (int i = 0; i < points.Length; i++)
            {
                newpoints[i] = points[i];
                newpoints[i] = newpoints[i] + 500;
            }
            Console.WriteLine("\n序號\t\t歷史積分\t新年積分");
            for (int k = 0; k < points.Length; k++)
            {
                Console.WriteLine("\n" + (k + 1) + "\t\t" + points[k] + "\t\t" + newpoints[k]);
            }
            Console.ReadLine();

        }
    }
}