using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 超市仓库
{
class 前台:cangku
{
static void Main(string[] args)
{
string name;
int num;
double price=0;
cangku k = new cangku();
int num1 = 200;
sp[] s=new sp[num1];
for (int i = 0; i < num1; i++)
{
s[i] = new sp();
s[i].ID1 = "0";
}
k.Spnum= 0;
k.Spsum = num1;
k.addsp(s,"食品","哇哈哈",100,5);
k.addsp (s,"食品","huo",100,4);
k.addsp (s,"sss","aaa",100,4.1);
Console.WriteLine("欢迎来到超市");
Console.WriteLine("我们超市有");
k.showsp(s);
Console.WriteLine("需要买点什么?");
for (; ; )
{
Console.WriteLine("输入商品--输入0结束");
name = Console.ReadLine ();
if (name == "0")break;
Console.WriteLine("输入数量");
num = Convert.ToInt32(Console.ReadLine());//输入转化为int
price += k.buysp(s,name,num);
}
Console.WriteLine(price);
price = 0;
Console.WriteLine("谢谢惠顾");
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 超市仓库
{
class 前台:cangku
{
static void Main(string[] args)
{
string name;
int num;
double price=0;
cangku k = new cangku();
int num1 = 200;
sp[] s=new sp[num1];
for (int i = 0; i < num1; i++)
{
s[i] = new sp();
s[i].ID1 = "0";
}
k.Spnum= 0;
k.Spsum = num1;
k.addsp(s,"食品","哇哈哈",100,5);
k.addsp (s,"食品","huo",100,4);
k.addsp (s,"sss","aaa",100,4.1);
Console.WriteLine("欢迎来到超市");
Console.WriteLine("我们超市有");
k.showsp(s);
Console.WriteLine("需要买点什么?");
for (; ; )
{
Console.WriteLine("输入商品--输入0结束");
name = Console.ReadLine ();
if (name == "0")break;
Console.WriteLine("输入数量");
num = Convert.ToInt32(Console.ReadLine());//输入转化为int
price += k.buysp(s,name,num);
}
Console.WriteLine(price);
price = 0;
Console.WriteLine("谢谢惠顾");
Console.ReadKey();
}
}
}