美文网首页
c#第10次作业

c#第10次作业

作者: 八度_八度 | 来源:发表于2018-12-26 14:29 被阅读0次

    要求:

    /**
    * 显示商品名称
    * (1) . 创建一个长度为5的String数组,存储商品名称。
    * (2) . 使用循环输出商品名称
    **/

    代码:

    namespace 作业1
    {
    class Program
    {
    static void Main(string[] args)
    {
    /**
    * 显示商品名称
    * (1) . 创建一个长度为5的String数组,存储商品名称。
    * (2) . 使用循环输出商品名称
    **/
    try {
    string[] scores = {"Nike背包","Adidas运动衫","李宁运动鞋","Kappa外套","361°腰包"};;

                Console.WriteLine("本次活动特价商品有:");
                for (int i = 0; i < scores.Length; i++) 
                {
                    Console.WriteLine(scores[i]);
                }
                }
    
            catch {
                    Console.WriteLine("你输入的数据有误,请重新输入!");
                  }
            Console.ReadKey();
        }
    } 
    

    }

    效果图:

    1.jpg

    相关文章

      网友评论

          本文标题:c#第10次作业

          本文链接:https://www.haomeiwen.com/subject/mmugcqtx.html