我正在制作一个简单的程序,从输入的 ID 中获取用户余额。由于某种原因,当输入 listof_ID 数组中的 ID 时,for 循环不会执行:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main()
{
int cntr;
int ID;
int listof_ID[] = {001, 002, 003, 004, 005};
float listof_BAL[] = {338.90, 745.87, 897.32, 665.36, 102.45};
puts("**Check Your Balance** \n");
printf("**Please Enter Your ID >> ");
scanf("%d", &ID);
for(cntr = 0; cntr > 5; cntr++)
{
if(ID == listof_ID[cntr])
{
puts("Your balance is ");
printf("%.2f", listof_BAL[cntr]);
break;
}
}
return 0;
}