I have the following code and I would like it to break after entering the sentinel number only once but at the moment I have to input the sentinel number twice for the code to break. Any ideas?
#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;
}