利用C#编写一个控制台应用程序,实现用户输入学号,姓名,班级等信息后,在控制台打印用户输入的信息.

2024-11-11 03:52:18
推荐回答(1个)
回答1:

using System;
using System.Collections.Generic;
using System.Text;
using System.Data.OleDb;
using System.Data;
using System.Text.RegularExpressions;


namespace Demo6
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("学号");
            string xuehao = Console.ReadLine();
            Console.WriteLine("姓名");
            string xingming = Console.ReadLine();
            Console.WriteLine("班级");
            string banji = Console.ReadLine();
            Console.WriteLine("年龄");
            string nianling = Console.ReadLine();
            Console.WriteLine("性别");
            string xingbie = Console.ReadLine();
            Console.WriteLine("学号:{0} 姓名:{1} 班级:{2} 年龄:{3} 性别:{4}",xuehao,xingming,banji,nianling,xingbie);
            Console.ReadKey();
         }
    }
}