/*如下写法有报错:the name 'age' does not exit in the current context.
int[] age = new int[4];
age[0] = 18;
age[1] = 19;
age[2] = 20;
age[3] = 21;
Console.WriteLine("四位同学的年龄分别是:{0}、{1}、{2}、{3}", age[0], age[1], age[2], age[3]);
int[] age = new int[4];
age[0] = 18;
age[1] = 19;
age[2] = 20;
age[3] = 21;
Console.WriteLine("四位同学的年龄分别是:{0}、{1}、{2}、{3}", age[0], age[1], age[2], age[3]);
2016-06-02
最新回答 / 悟於此城
Console.Write("我的工资奖金总额是{0}元",salary+prize); Console.WriteLine("我的税后收入是{0}元",salary+prize-tax); //问题出在Console.WriteLine和 Console.Write上!不知道怎么解释。
2016-06-02
最赞回答 / 木刻雪原
根据你的问题,我给你举个例子;Consle.writeline("x+y:{0}",result);这行是输出代码对吧,然后你看,比如x=1,y=2,result=x+y,然后我利用这行代码输出;根据C#规则,应该输出双引号里的内容,可是我现在这样写了,就是输出x+y:3,因为在C#中输出{0}表示第一个逗号以后的第一个变量值;再如:Consle.writeline("x+y:{0}{1}",result,resutl1);我输出的就是x+y:第一个变量值 第二个变量值总结的说,就是我的输出{0}{1}{...
2016-06-02
string[] name=new string[] {"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int[] score=new int[] {89,90,98,56,60,91,93,85};
int x=0;
int max=0;
for(int i=0;i<score.Length;i++) {
if(max<score[i]){
max=score[i];
x=i; } }
Console.Write("分数最高的是{0},分数是{1}",name[x],score[x])}}
int[] score=new int[] {89,90,98,56,60,91,93,85};
int x=0;
int max=0;
for(int i=0;i<score.Length;i++) {
if(max<score[i]){
max=score[i];
x=i; } }
Console.Write("分数最高的是{0},分数是{1}",name[x],score[x])}}
static void Main(string[] args)
{
string[] job = { "经理", "项目主管", "技术总监", "财务主管" };
for (int x = 0; x < job.Length; x++)
{
Console.WriteLine(job[x]);
}
}
{
string[] job = { "经理", "项目主管", "技术总监", "财务主管" };
for (int x = 0; x < job.Length; x++)
{
Console.WriteLine(job[x]);
}
}
2016-06-01