• 大小: 0.04M
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-02-23
  • 语言: C#
  • 标签: C#  热水器  

资源简介

模仿热水器加热的过程,代码中添加了定时器等。可以简单模拟加热过程。方法和接口等设置合理。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Heater
{
    class Program
    {
        static void Main(string[] args)
        {
            //设定初始水温20度
            int tempeature = 20;
            //从初始温度开始加热,直到100度结束
            for (int i = tempeature; i < 100; i++)
            {
                //水温加热升高1度
                tempeature++;
                //显示当前水温
                Display(tempeature.ToString());                
                //判断当前水温是否超过警戒温度
                if (tempeature >= 95)
                {
                    //如果超过警戒温度,报警
                    MakeAlert(tempeature.ToString());
                }
                //没有超过警戒温度,继续加热,延时1秒
                System.Threading.Thread.Sleep(1000);
            }
        }
        /// 
        /// 通过液晶显示器显示某个信息
        /// 

        /// 要显示的信息
        static void Display(string msg)
        {
        

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5120  2019-12-03 11:57  Heater_Demo\Heater\Heater\bin\Debug\Heater.exe

     文件      11776  2019-12-03 11:57  Heater_Demo\Heater\Heater\bin\Debug\Heater.pdb

     文件      11600  2019-12-03 11:13  Heater_Demo\Heater\Heater\bin\Debug\Heater.vshost.exe

     文件        490  2010-03-17 22:39  Heater_Demo\Heater\Heater\bin\Debug\Heater.vshost.exe.manifest

     文件       2433  2019-12-03 11:13  Heater_Demo\Heater\Heater\Heater.csproj

     文件       5907  2019-12-09 18:25  Heater_Demo\Heater\Heater\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        227  2019-12-03 11:57  Heater_Demo\Heater\Heater\obj\x86\Debug\Heater.csproj.FileListAbsolute.txt

     文件       5120  2019-12-03 11:57  Heater_Demo\Heater\Heater\obj\x86\Debug\Heater.exe

     文件      11776  2019-12-03 11:57  Heater_Demo\Heater\Heater\obj\x86\Debug\Heater.pdb

     文件       1667  2019-12-03 11:34  Heater_Demo\Heater\Heater\Program.cs

     文件       1362  2019-12-03 11:13  Heater_Demo\Heater\Heater\Properties\AssemblyInfo.cs

     文件       1234  2019-12-09 18:26  Heater_Demo\Heater\Heater.sln

    ..A..H.     27648  2019-12-09 19:50  Heater_Demo\Heater\Heater.suo

     文件        499  2019-12-03 11:54  Heater_Demo\Heater\Heater_1\Alarm.cs

     文件       6144  2019-12-09 19:49  Heater_Demo\Heater\Heater_1\bin\Debug\Heater_1.exe

     文件      22016  2019-12-09 19:49  Heater_Demo\Heater\Heater_1\bin\Debug\Heater_1.pdb

     文件      11600  2019-12-09 18:25  Heater_Demo\Heater\Heater_1\bin\Debug\Heater_1.vshost.exe

     文件        490  2019-03-19 12:46  Heater_Demo\Heater\Heater_1\bin\Debug\Heater_1.vshost.exe.manifest

     文件        533  2019-12-03 11:58  Heater_Demo\Heater\Heater_1\Display.cs

     文件       1482  2019-12-09 19:49  Heater_Demo\Heater\Heater_1\Heater.cs

     文件       2548  2019-12-03 11:57  Heater_Demo\Heater\Heater_1\Heater_1.csproj

     文件       5911  2019-12-09 19:49  Heater_Demo\Heater\Heater_1\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache

     文件        613  2019-12-09 18:25  Heater_Demo\Heater\Heater_1\obj\x86\Debug\Heater_1.csproj.FileListAbsolute.txt

     文件       6144  2019-12-09 19:49  Heater_Demo\Heater\Heater_1\obj\x86\Debug\Heater_1.exe

     文件      22016  2019-12-09 19:49  Heater_Demo\Heater\Heater_1\obj\x86\Debug\Heater_1.pdb

     文件        598  2019-12-09 19:49  Heater_Demo\Heater\Heater_1\Program.cs

     文件       1366  2019-12-03 11:35  Heater_Demo\Heater\Heater_1\Properties\AssemblyInfo.cs

     目录          0  2019-12-03 11:13  Heater_Demo\Heater\Heater\obj\x86\Debug\TempPE

     目录          0  2019-12-03 11:35  Heater_Demo\Heater\Heater_1\obj\x86\Debug\TempPE

     目录          0  2019-12-03 11:57  Heater_Demo\Heater\Heater\obj\x86\Debug

............此处省略18个文件信息

评论

共有 条评论