Turbo C的数组问题 [英] Turbo C Array Question

查看:131
本文介绍了Turbo C的数组问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想问一些关于我的code。

I just want to ask something about my code.

#define LIM 40

main()
{
       int day=0;
       float temp[LIM];

       clrscr();

       do
       {
               printf("Enter temperature for day %d.", day);
               scanf("%f", &temp[day]);
       }
       while(temp[day++] > 0)
}

我使用TURBOC,这code一再要求用户输入的温度和阵列中存储的响应 温度,直到0的温度或输入以下。我已经使用了 的#define 指令给标识符 LIM 40值,因为我想要这个程序接受任何数量的温度高达40 但它实际上接受多达48 ...我应该怎么做,这样它可以接受多达40只?

I'm using TurboC, this code repeatedly asks the user to enter a temperature and stores the responses in the array temp, until a temperature of 0 or less is entered. I've used a #define directive to give the identifier LIM the value of 40 because I want this program to accept any number of temperatures up to 40. But It actually accepts up to 48... What should I do so that it could accept up to 40 only?

在此先感谢

推荐答案

更改,而条件如下:而(TEMP [日++]大于0和放大器;和天< LIM)

这篇关于Turbo C的数组问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆