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
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])}}