c# 输入字符串的格式不正确怎么改
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespa...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 超市收银软件
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("==============MC潮鞋收银系统=============");
Console.WriteLine("收银时间:" + DateTime.Now.ToLocalTime());
Console.WriteLine("收款单号:模拟单号001 收银员:sdsd");
Console.WriteLine("=========================================");
int zhonGer = 0;//zhonGer=总价
while (true)
{
Console.Write("请输入商品编码:");
string bianHao = Console.ReadLine();//bianHao =编码
string shuLiang = "商品" + bianHao;
int jiaGe = new Random().Next(300, 600);//jiaGe=价格
Console.Write("请输入商品数量:");
int shuLian = int.Parse(Console.ReadLine());//shulian=数量
zhonGer += jiaGe * shuLian;
Console.WriteLine("{0} {1]*{2}={3}", shuLiang, jiaGe, shuLian, jiaGe*shuLian);
Console.Write("是否继续输入下个商品<Y/N>");
string xiaBu = Console.ReadLine();
if (xiaBu == "N")
break;
}
Console.WriteLine("{0} {1]*{2}={3}", shuLiang, jiaGe, shuLian, jiaGe*shuLian);这句显示输入字符串的格式不正确,求怎么改。初学! 展开
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 超市收银软件
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("==============MC潮鞋收银系统=============");
Console.WriteLine("收银时间:" + DateTime.Now.ToLocalTime());
Console.WriteLine("收款单号:模拟单号001 收银员:sdsd");
Console.WriteLine("=========================================");
int zhonGer = 0;//zhonGer=总价
while (true)
{
Console.Write("请输入商品编码:");
string bianHao = Console.ReadLine();//bianHao =编码
string shuLiang = "商品" + bianHao;
int jiaGe = new Random().Next(300, 600);//jiaGe=价格
Console.Write("请输入商品数量:");
int shuLian = int.Parse(Console.ReadLine());//shulian=数量
zhonGer += jiaGe * shuLian;
Console.WriteLine("{0} {1]*{2}={3}", shuLiang, jiaGe, shuLian, jiaGe*shuLian);
Console.Write("是否继续输入下个商品<Y/N>");
string xiaBu = Console.ReadLine();
if (xiaBu == "N")
break;
}
Console.WriteLine("{0} {1]*{2}={3}", shuLiang, jiaGe, shuLian, jiaGe*shuLian);这句显示输入字符串的格式不正确,求怎么改。初学! 展开
1个回答
展开全部
输入的内容,要能转换为数字的才行。你输入 数字就可以了,其它符号都不要
更多追问追答
追问
例如呢??在运行的时候,他直接输入到那个位置的时候 就什么都按不了
追答
例如 请输入商品编码:
你输入 96,然后按回车。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询