-1
我有下面的代码,我希望它在进入哨兵号码后只能打破一次,但此刻我必须输入两次哨兵号码来破解代码。有任何想法吗?哨兵循环执行在c
#include <stdio.h>// Include a standard C Library
#define Sentinel_Numb -1
int main(){
int ID[360];
float seconds[360];
int i = 0;
printf("please enter the ID and how many seconds to calculate enter -1 when done\n");
while (1)
{
scanf_s("%d",&ID[i]);
scanf_s("%f",&seconds[i]);
if(ID[i] == Sentinel_Numb || seconds[i] == Sentinel_Numb){
break;
}
i++;
}
return 0;
}
我想'i'定义和初始化的地方? – yano
不编译...“我”没有定义。 – TonyB
抱歉只编辑了问题来初始化我 – drez