您的位置:首页 > 其它

语句

2015-10-29 17:00 381 查看
Console.WriteLine("你能跑的过豹子吗?(能?不能)");

string a =Console.ReadLine();

if(a=="能")

{

Console.WriteLine("你比禽兽还禽兽");

}

else if (a == "不能")

{

Console.WriteLine("你连禽兽都不如");

}

else

{

Console.WriteLine("输入有误!");

}

Console.ReadLine();



//判断输入的内容是(能)或者(不能) 还是其他

//if() {} elseif(){} ....else{}

}Console.Write("请输入x=");

int x = int.Parse(Console.ReadLine());

Console.Write("请输入Y=");

int Y = int.Parse(Console.ReadLine());

if (x >= Y)

{

Console.WriteLine(x + " " + Y);

}

else

{

int zhong;//利用中间变量,将两个变量的值 进行互换

zhong = x;

x = Y;

Y = zhong;

Console.WriteLine(Y+""+x);

}

Console.ReadLine();



Console.Write("请输入x=");

int x = int.Parse(Console.ReadLine());

Console.Write("请输入Y=");

int Y = int.Parse(Console.ReadLine());

Console.Write("请输入z=");

int z = int.Parse(Console.ReadLine());

if (x < Y && x < z)

{

Console.WriteLine(x);

if (Y < z)

{

Console.WriteLine(Y); Console.WriteLine(z);

}

else

{

Console.WriteLine(z); Console.WriteLine(Y);

}

}

if (Y < x && Y < z)

{

{

Console.WriteLine(Y);

}

if (x < z)

{

Console.WriteLine(x); Console.WriteLine(z);

}

else

{

Console.WriteLine(z); Console.WriteLine(x);

}

}

if (z < x && z < Y)

{

{

Console.WriteLine(z);

}

if (x < Y)

{

Console.WriteLine(x); Console.WriteLine(Y);

}

else

{

Console.WriteLine(Y); Console.WriteLine(x);

}

}



Console.WriteLine("输入一个小于等于100的整数:");

int a = int.Parse(Console.ReadLine());

if (a <= 100)//先保证输入的数是小于等于100

{

if (a < 10)//先排除小于十的

{

Console.WriteLine("这是个小于10的整数");

}

else//剩下10-100

{

if (a == 100)

{

Console.WriteLine("这个数是100!");

}

else//剩下的就是10-99

{

Console.WriteLine("这个数是两位数");

}

Console.Write("输入学生姓名:");

string name = Console.ReadLine();

Console.Write("输入考试成绩:");

double a = double.Parse(Console.ReadLine());

if(a<=100&&a>0)

{

if (a == 100)//排除掉100

{

Console.WriteLine("恭喜," + name + "满分通过");

}

else//剩下0-99

{

if (a >= 80)//排除90-80的

{

Console.WriteLine("" + name + "你很优秀,请继续保持");

}

else//剩下0-79的

{

if (a >= 60)//排除60以上的

Console.WriteLine("" + name + "成绩良好");

else

{

if (a >= 50)//排除50以上的

{

Console.WriteLine(name + "就差一点点,下次一定要及格");

}

else//剩下0-49的

{

Console.WriteLine(name + "你是笨蛋吗?");

}

}

}



onsole.Write("请输入一个数:");

int x = int.Parse(Console.ReadLine());

Console.Write("请再输入一个数:");

int y = int.Parse(Console.ReadLine());

Console.Write("请再输入一个数:");

int z = int.Parse(Console.ReadLine());

int zhong;

if(x>y)

{

zhong =x;

x=y;

y=zhong;

}

if(x>z)

{

zhong=x;

x=z;

z=zhong;

}

if(y>z)

{

zhong =y;

y=z;

z=zhong;

}

Console.Write(x+"" +y+""+z);

}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: