命名空间中包含若干各类,mian方法是C#程序的入口,运行一个程序的命令是conslse.write
2017-09-23
switch (job) { case"局长":Console.WriteLine("发双黄月饼");break;
case "处长":Console.WriteLine("发蛋黄月饼");break;
case "科长":Console.WriteLine("发普通月饼");break;
case "员工":Console.WriteLine("没有");break;
default: Console.WriteLine("运算符出错"); break;
case "处长":Console.WriteLine("发蛋黄月饼");break;
case "科长":Console.WriteLine("发普通月饼");break;
case "员工":Console.WriteLine("没有");break;
default: Console.WriteLine("运算符出错"); break;
2017-09-23
for(int x=0;x<7;x++){
for(int y=0;y<7;y++){
if(x==y||y==6-x){
Console.Write("o");
}else{
Console.Write(".");
}} Console.WriteLine();
for(int y=0;y<7;y++){
if(x==y||y==6-x){
Console.Write("o");
}else{
Console.Write(".");
}} Console.WriteLine();
string[] n={"景珍","林惠洋","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"};
int[] s={90,65,88,70,46,81,100,68};
int sum=0;
foreach(int x in s) sum+=x;
double avg = sum/s.Length;
Console.WriteLine("平均分是"+avg+",高于平均分的有:");
for(int i=0;i<s.Length;i++) if(s[i]>avg) Console.Write(n[i]+" ");
int[] s={90,65,88,70,46,81,100,68};
int sum=0;
foreach(int x in s) sum+=x;
double avg = sum/s.Length;
Console.WriteLine("平均分是"+avg+",高于平均分的有:");
for(int i=0;i<s.Length;i++) if(s[i]>avg) Console.Write(n[i]+" ");
string[] name = {"吴松","钱东宇","伏晨","陈陆","周蕊","林日鹏","何昆","关欣"};
int[] score = {89,90,98,56,60,91,93,85};
int key = -1;
if (name.Length==score.Length) for(int i=0; i<score.Length; i++) key = (key<0||score[i]>score[key])?i:key;
if(key>=0) Console.WriteLine("分数最高的是{0},分数是{1}",name[key],score[key]);
int[] score = {89,90,98,56,60,91,93,85};
int key = -1;
if (name.Length==score.Length) for(int i=0; i<score.Length; i++) key = (key<0||score[i]>score[key])?i:key;
if(key>=0) Console.WriteLine("分数最高的是{0},分数是{1}",name[key],score[key]);