Demo entry 5862329

dic

   

Submitted by anonymous on Aug 03, 2016 at 17:46
Language: C#. Code size: 1.1 kB.

using System;

namespace DEMO
{
	/// <summary>
	/// Description of Class1.
	/// </summary>
	public class Class1
	{
		 static void Main(string[] args)
      {
         /* 我的第一个 C# 程序*/
        
        Console.Write("输入当前温度:");
            int Tem = Convert.ToInt32(Console.ReadLine());
            Console.Write("输入当前是否下雨(true下雨;false不下雨):");
            Boolean ifruain=Convert.ToBoolean(Console.ReadLine());
            temandrain(Tem,ifruain);
            Console.ReadKey();
      }
		 public static void temandrain(int Tem,Boolean ifruain ){
		 	
		 	if(ifruain is Boolean){
            if(Tem<=15){
            Console.Write("天气寒冷,适合窝在家里看片");
            }else if(15<Tem&&Tem<=30&&ifruain){
            	Console.Write("天气不错,记得带伞");
            }else if(15<Tem&&Tem<=30&&!ifruain){
            	Console.Write("天气不错,放风筝");
            }else if(Tem>30){
            	Console.Write("炎炎夏日,泡温泉");
            }
            }else{
            	Console.Write("请重新输入是否下雨:(true为下雨,false为不下雨)");
            	
            }
		 }
		 	
	}
	

}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).