版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wtxhai/article/details/88736137
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Example701_02
{
class goods //定义商品的类
{
public int goods_num;
public string goods_name;
}
class Program
{
static void Main(string[] args)
{
goods g = new goods();
Console.Write("请输入商品编号:");
g.goods_num = Convert.ToInt32(Console.ReadLine()); //接收输入的商品编号
Console.Write("请输入商品名称:");
g.goods_name = Console.ReadLine(); //接收输入的商品名称
Console.WriteLine("商品的编号是:{0},商品的名称是:{1}", g.goods_num, g.goods_name); //输出接收到的值
Console.ReadLine();
}
}
}