《零基础学C#》第六章-实例03:选择商品——练习1

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wtxhai/article/details/88638092
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Example603_01
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("**************商品列表************");
            Console.WriteLine();
            Console.WriteLine("1.iPhone(16GB) 5288 \n2.荣耀6(Plus高配版) 2299 \n3.一加手机(标准版) 1999.99 \n");
            int id = Convert.ToInt32(Console.ReadLine());
            if (id == 1) 
            {
                Console.WriteLine("你选择的是iPhone(16GB),价格为:{0:C}", 5288);
            }
            else if (id == 2) 
            {
                Console.WriteLine("你选择的是荣耀6(Plus高配版),价格为:{0:C}", 2299);
            }
            else if (id == 3) 
            {
                Console.WriteLine("你选择的是荣耀6(Plus高配版),价格为:{0:C}", 1999.99);
            }
            Console.ReadLine();
        }
    }
}

猜你喜欢

转载自blog.csdn.net/wtxhai/article/details/88638092