已采纳回答 / qq_龙之心_1
int是表示的是整型变量,通俗的说就是整数,3.5是浮点型数字。强制类型转换成int的时候是自取整数部分,小数不分直接舍弃,没有四舍五入的规则。
2016-01-20
string[] t =new string[]{"C","Sh","a","rp"};
//遍历字符串数组t
foreach(string x in t)
{
Console.Write(x);
}
//遍历字符串数组t
foreach(string x in t)
{
Console.Write(x);
}
2016-01-20
string[]name=new string[]{"景珍","林惠洋","成蓉","洪南昌","龙玉民","单江开"...};
int[]score=new int[]{90,65,88,70,46,81,100,68};
int a=0;
foreach(int x in score)
a+=x;
a/=score.Length;
Console.WriteLine("平均分是{0},高于平均分的有:",a);
for(int x=0;x<score.Length;x++)
if(score[x]>a)
Console.Write(name[x]+' ');
int[]score=new int[]{90,65,88,70,46,81,100,68};
int a=0;
foreach(int x in score)
a+=x;
a/=score.Length;
Console.WriteLine("平均分是{0},高于平均分的有:",a);
for(int x=0;x<score.Length;x++)
if(score[x]>a)
Console.Write(name[x]+' ');