개인 및 총 킬로와트 사용 시간과 요금, 고객 총계를 찾는 프로그램을 만들고 있습니다. 내가받는 오류 메시지는 undefined reference to "If"
과 Id returned 1 exit status
입니다. 이 문제의 원인은 무엇입니까? 당신은 오류 메시지가 인터넷 검색을 시도하지 않은프로그램의 사소한 문제
/* program to determine cost for a certain number of kilowatt hours */
#include <stdio.h> /* printf, scanf definitions */
#include <math.h>
double charges_to_return(int kwh_f);
int main (void)
{
int cust_number;
int kwh;
int total_cust;
int total_kwh;
double total_charge;
double cust_charge;
double charge;
total_cust = 0;
total_kwh = 0;
total_charge = 0;
cust_number = 0;
while (cust_number != -1)
{
printf("Enter customer number and kwh (-1 to quit): ");
scanf("%d %d", &cust_number, &kwh);
If (cust_number != -1);
{
total_cust++;
total_kwh = total_kwh + kwh;
cust_charge = charges_to_return(kwh);
total_charge = total_charge + cust_charge;
printf("Customer Num: %d KWH used: %d Charge: %.2lf", cust_number, kwh, cust_charge);
}
}
printf("Total Customers: %d Total KWH used: %d Total Charges: %.2f", total_cust, total_kwh, total_charge);
return (0);
}
C는 대소 문자를 구분합니다. 당신은 If를 가지고 있지 않습니다. – Ben
이 매우 숙제 같아 보이지 않는 경우 .. – Ben
'If (cust_number! = -1);'->'if (cust_number! = -1)'note ';' – BLUEPIXY