int x=1;
bool a = ++x * x > 3;
bool b = true;//请赋值
Console.WriteLine(a==b);
bool a = ++x * x > 3;
bool b = true;//请赋值
Console.WriteLine(a==b);
2016-06-03
//声明整型数组,保存一组整数
int[] num = new int[] { 3, 34, 42, 2, 11, 19, 30, 55, 20 };
//请完善代码,循环打印数组中的偶数
for (int a = 0; a < num.Length; a++)//定义整数类型变量a, a小于数组num个数,a=a+1自增
{
if (num[a] % 2 == 0)//判断数组num[a]余2是否等于0
{
Console.Write(num[a] + ",");//是则输出该数组,否则完成判断进入下一次循环
去掉部分代码是因为回复字数有限制
int[] num = new int[] { 3, 34, 42, 2, 11, 19, 30, 55, 20 };
//请完善代码,循环打印数组中的偶数
for (int a = 0; a < num.Length; a++)//定义整数类型变量a, a小于数组num个数,a=a+1自增
{
if (num[a] % 2 == 0)//判断数组num[a]余2是否等于0
{
Console.Write(num[a] + ",");//是则输出该数组,否则完成判断进入下一次循环
去掉部分代码是因为回复字数有限制
for (int i = 0; i < score.Length; i++)
{
if (score[i] > max)
{
Console.Write(name[i] + " ");
}
}
{
if (score[i] > max)
{
Console.Write(name[i] + " ");
}
}
int sum = 0, avg;
for (int i = 0; i < score.Length; i++)
{
sum += score[i];
}
avg = sum / score.Length;
Console.Write("平均分是{0},", avg);
int max = avg;
Console.WriteLine("高于平均分的有:");
for (int i = 0; i < score.Length; i++)
{
sum += score[i];
}
avg = sum / score.Length;
Console.Write("平均分是{0},", avg);
int max = avg;
Console.WriteLine("高于平均分的有:");
Console.WriteLine(x+" ") 谁解释一下 。看不懂x+""
打印变量X后再打印一个空格
打印变量X后再打印一个空格
2016-06-03
/*如下写法有报错: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])}}