说一个不需要temp变量就可以实现交换的办法
int a=12;
int b = 23;
a = a +b;
b=a - 2 *b;
a = (a -b)/2;
b= b + a;
int a=12;
int b = 23;
a = a +b;
b=a - 2 *b;
a = (a -b)/2;
b= b + a;
2018-06-24
for(int i=0;i<score.Length;i++)
{
if(score[i]>Max)
{
Max=score[i];
index=i;
}
}
Console.WriteLine ("分数最高的是" + name[index] + ",分数是" + Max);
{
if(score[i]>Max)
{
Max=score[i];
index=i;
}
}
Console.WriteLine ("分数最高的是" + name[index] + ",分数是" + Max);
string[] name={"吴松","钱东宇","伏晨","陈陆","周茹","林日鹏","何昆","关欣"};
int[]score={89,90,98,56,60,91,93,85};
int Max=0;
int index=0;
int[]score={89,90,98,56,60,91,93,85};
int Max=0;
int index=0;
private int GetMaxNumber(int[] array)
{
int max = int.MinValue;
for (int index = 0; index < array.Length; index++)
{ if (max < array[index])
{
max = array[index];
} }
return max;
}
{
int max = int.MinValue;
for (int index = 0; index < array.Length; index++)
{ if (max < array[index])
{
max = array[index];
} }
return max;
}
2018-06-11