求C#高手解答一下,这里到底是哪里出现问题
staticvoidMain(string[]args){doublefirstnumber,secondnumber;stringusername;Console.Wr...
static void Main(string[] args)
{
double firstnumber,secondnumber;
string username;
Console.WriteLine("enter your name:");
username = Console.readline();
Console.Writeline("welcome {0}!", username);
Console.WriteLine("now give me a number:");
firstnumber =Convert.ToDouble (console.readline());
Console.WriteLine("now give another number:");
secondnumber =Convert .ToDouble (Console.ReadLine());
Console.Writeline("the sum of {0})and (1) is (2).",firstnumber,secondnumber ,firstnumber + secondnumber);
Console.WriteLine ("the result of subtracing{0} from {1} is {2}.",secondnumber ,firstnumber ,firstnumber - secondnumber);
Console.WriteLine ("the product of {0} and {1} is {2}.",firstnumber,secondnumber,firstnumber * secondnumber);
Console.WriteLine("the result of dividing {0} by {1} is {2}.",firstnumber ,secondnumber ,firstnumber / secondnumber );
Console.WriteLine("the remainder after dividing {0} by {1} is {2}.", firstnumber , secondnumber ,firstnumber % secondnumber );
Console.readkey();
} 展开
{
double firstnumber,secondnumber;
string username;
Console.WriteLine("enter your name:");
username = Console.readline();
Console.Writeline("welcome {0}!", username);
Console.WriteLine("now give me a number:");
firstnumber =Convert.ToDouble (console.readline());
Console.WriteLine("now give another number:");
secondnumber =Convert .ToDouble (Console.ReadLine());
Console.Writeline("the sum of {0})and (1) is (2).",firstnumber,secondnumber ,firstnumber + secondnumber);
Console.WriteLine ("the result of subtracing{0} from {1} is {2}.",secondnumber ,firstnumber ,firstnumber - secondnumber);
Console.WriteLine ("the product of {0} and {1} is {2}.",firstnumber,secondnumber,firstnumber * secondnumber);
Console.WriteLine("the result of dividing {0} by {1} is {2}.",firstnumber ,secondnumber ,firstnumber / secondnumber );
Console.WriteLine("the remainder after dividing {0} by {1} is {2}.", firstnumber , secondnumber ,firstnumber % secondnumber );
Console.readkey();
} 展开
5个回答
展开全部
大小写搞错了,还有一处本来应该用花括号,你用了小括号
这是我改过的
static void Main(string[] args)
{
double firstnumber, secondnumber;
string username;
Console.WriteLine("enter your name:");
username = Console.ReadLine();
Console.WriteLine("welcome {0}!", username);
Console.WriteLine("now give me a number:");
firstnumber = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("now give another number:");
secondnumber = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("the sum of {0} and {1} is {2}.", firstnumber, secondnumber, firstnumber + secondnumber);
Console.WriteLine("the result of subtracing{0} from {1} is {2}.", secondnumber, firstnumber, firstnumber - secondnumber);
Console.WriteLine("the product of {0} and {1} is {2}.", firstnumber, secondnumber, firstnumber * secondnumber);
Console.WriteLine("the result of dividing {0} by {1} is {2}.", firstnumber, secondnumber, firstnumber / secondnumber);
Console.WriteLine("the remainder after dividing {0} by {1} is {2}.", firstnumber, secondnumber, firstnumber % secondnumber);
Console.ReadKey();
}
这是我改过的
static void Main(string[] args)
{
double firstnumber, secondnumber;
string username;
Console.WriteLine("enter your name:");
username = Console.ReadLine();
Console.WriteLine("welcome {0}!", username);
Console.WriteLine("now give me a number:");
firstnumber = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("now give another number:");
secondnumber = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("the sum of {0} and {1} is {2}.", firstnumber, secondnumber, firstnumber + secondnumber);
Console.WriteLine("the result of subtracing{0} from {1} is {2}.", secondnumber, firstnumber, firstnumber - secondnumber);
Console.WriteLine("the product of {0} and {1} is {2}.", firstnumber, secondnumber, firstnumber * secondnumber);
Console.WriteLine("the result of dividing {0} by {1} is {2}.", firstnumber, secondnumber, firstnumber / secondnumber);
Console.WriteLine("the remainder after dividing {0} by {1} is {2}.", firstnumber, secondnumber, firstnumber % secondnumber);
Console.ReadKey();
}
展开全部
异常代码发出来看下!
你这代码看的眼花!没心情帮你仔细看!
你这代码看的眼花!没心情帮你仔细看!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
抛什么异常
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询