小编Jav*_*on 的帖子

数组值不能生成双精度值

我的代码中存在问题,即使我将其指定为双精度数据类型,平均值也是整数。可能是什么问题呢?

using System;
using static System.Console;
using System.Linq;
class TemperaturesComparison
{
   static void Main()
   {
     int[] temp = new int[5];
     int i = 0;
     while (i < 5)
     {
       int eachTemp = int.Parse(ReadLine());
       if (eachTemp < -30 || eachTemp > 130) continue; //skips 
       temp[i] = eachTemp;
       i++;
     }
     
     if (temp[0] < temp[1] && temp[1] < temp[2] && temp[2] < temp[3] && temp[3] < temp[4]) WriteLine("Getting warmer");
     else if (temp[0] > temp[1] && temp[1] > temp[2] && temp[2] > temp[3] && …
Run Code Online (Sandbox Code Playgroud)

c#

4
推荐指数
1
解决办法
73
查看次数

标签 统计

c# ×1