행복한 프로그래밍

id passport

영웅*^%&$ 2018. 2. 26. 21:36
728x90

#include <stdio.h>
main()
{
    int ctr;
    int idSearch;
    int found = 0;

    int custID[10] = { 313, 453, 502, 101, 892, 475, 792, 912, 343, 633 };
    float custBal[10] = { 0.00, 45.43, 71.23, 301.56, 9.08, 192.41, 389.00, 229.67, 18.31, 59.54 };

    printf("\n\n*** 고객 카드 사용액 검색 ***\n");
    printf("어떤 고객의 카드 사용액을 검색하시겠습니까? ");
    scanf(" %d", &idSearch);

    for (ctr = 0; ctr<10; ctr++)
    {
        if(idSearch == custID[ctr])
        {
            found = 1;
            break;
        }
    }

    if(found)
    {
        if (custBal[ctr] > 100.00)
        {
            printf("\n** 고객의 카드 사용액은 $%.2f.\n", custBal[ctr]);
            printf(" 더 이상의 사용은 불가능합니다 \n");
        }
        else
        {
            printf("\n**  고객의 카드 사용액이 아직 여유가 있습니다! \n");
        }
    }
    else
    {
        printf("** 잘못된 사용자 ID입니다. ");
        printf("\n ID %3d은 발견되지 않았습니다. \n", idSearch);
    }
    return(0);

}

728x90

'행복한 프로그래밍' 카테고리의 다른 글

select (1)   (0) 2018.05.24
DataBase select 가장 기초되는 구문들 (scott의 경우)  (0) 2018.03.28
mozart family   (0) 2018.02.26
grade   (0) 2018.02.26
value algorithm   (0) 2018.02.26