說一個不需要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
using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(String[]args)
{
Console.WriteLine("今日事,今日畢。");
}
}
}
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(String[]args)
{
Console.WriteLine("今日事,今日畢。");
}
}
}
2018-05-25