我在编写代码方面遇到麻烦

时间:2020-11-10 05:07:38

标签: c++

So here's what i need to code

我在解决编码方面遇到麻烦,对编码来说还很陌生,请耐心等待。我不知道该如何解决编码问题,我不确定自己的编码是否正确

Here are the errors im getting now (Updated)

编辑:感谢您告知EmployeeNo; (我现在已修复)

    float HourlyPay;
    float WeeklyHours;
    float RegularHours;
    float OvertimeHours;
    float RegularPay;
    float OvertimeWeekly;
    float OvertimePay;
    float GrossPay;
    float EmployeeNo;
    char tryAnother;
    
    
    do{
        
    system("CLS");
    printf("Please Input Employee No:");
    scanf("%f", &EmployeeNo);
    
    
    do{
        printf("No. of hours worked in a week:");
        scanf("%f", &WeeklyHours);
        
        OvertimeWeekly = WeeklyHours - 40;
        
        printf("No of hours of Overtime worked for the week");
        scanf("%d", &OvertimeWeekly);
        
        printf("Hourly Pay Rate (PHP):");
        scanf("%d", &HourlyPay);
        
if (OvertimeWeekly < 0) {
        OvertimeWeekly = 0;
}
    else if (WeeklyHours <= 40) {
            RegularHours = WeeklyHours;
            OvertimeHours = 0;
}
    else if (WeeklyHours > 40) {
            RegularHours = 40;
            OvertimeHours = WeeklyHours - 40;
}
    }
    do{
        printf("Try Another [Y/N]: ");
        scanf(" %c", &tryAnother);

    if  (tryAnother != 'N' && tryAnother != 'Y')
        printf("Invalid, Please Try Again\n");
        
        }while (tryAnother != 'N' && tryAnother != 'Y');
        }while (tryAnother != 'N' );
        
        printf("Exiting Program");
        return 0;
}
    

1 个答案:

答案 0 :(得分:1)

    float GrossPay;
    float EmployeeNo  // <-- You're missing a ';' here
    char tryAnother;