C语言语句

 

 

 

/*Console.Write("你能跑得过豹子吗,请输入 能/不能:");
string a = Console.ReadLine();//接收所输入的字符串内容,
if (a=="能")
{

Console.Write("你比禽兽还禽兽");
}
else if (a == "不能")
{
Console.Write("你连禽兽都不如");
}
else //必执行项,条件都不满足的情况下执行
Console.Write("您输入有误");

Console.ReadLine();*/

 

 

 

 中间变量的转换

/*Console.Write("请输入一个数a=");
int a = int.Parse(Console.ReadLine());
Console.Write("请输入一个数b=");
int b = int.Parse(Console.ReadLine());
Console.Write("请输入一个数c=");
int c=int.Parse(Console.ReadLine());

if (a >b)
{
int zhong;
zhong = a;
a = b;
b = zhong;
}


if (a>c)
{
int zhong;
zhong=a;
a=c;
c=zhong;
}


if (b>c)
{
int zhong;
zhong=b;
b=c;
c=zhong;
}

Console.Write(a+","+b+","+c);
Console.ReadLine();*/

 

 

 

 

 嵌套法

/*Console.Write("请输入一个100以内的整数:");
int a = int.Parse(Console.ReadLine());
if (a <= 100)//先确定输入的数是小于等于100
{
if (a < 10)//排除小于10的部分
{
Console.WriteLine("您输入的数小于10");
}

else//剩下的是10--100的部分
{
if (a == 100)//排除100
{
Console.WriteLine("你输入的数是100");
}
else//剩下的是10——100的部分
{
Console.WriteLine("你输入的数是两位数");
}
}
}
Console.ReadLine();*/

 

 

 

 


/*Console.Write("请输入姓名:");
string name = Console.ReadLine();
Console.Write("请输入考试成绩:");
double a=double.Parse(Console.ReadLine());//分数会有小数部分
if(a<=100 && a>0)
{
Console.Write("恭喜"+name+"满分通过");
}
if (a<100 && a>=80)
{
Console.Write(""+name+"很优秀,继续保持");
}
if(a>=60 && a<80)
{
Console.Write(""+name+"成绩良好");
}
if (a > 50 && a < 60)
{
Console.Write("" + name + "就差一点点,继续努力");
}
else
{
if (a < 50)
{
Console.Write(""+name+"你是猪吗");
}
if (a > 100)
{
Console.Write("您输入有误");
}
}
Console.ReadLine();*/

posted @ 2015-10-29 16:53  Cherry的冬天  阅读(170)  评论(0编辑  收藏  举报