小编Dan*_*ith的帖子

主{}括号上的语法错误,"期望的时间"?

我完全难过了.无论我做什么,我的编译器都认为我需要在上一次printf中使用while循环?它只是一直在寻找没有意义的事情.当我将它们添加到其中时只是告诉我它不应该存在,当我删除它时我被告知我需要它.

int main() {
float userInput; //The grades that the user inputs.
int passingGrade = 0; //Number of passing grades
int failingGrade = 0; //Failing grades
int invalidGrade = 0; //Invalid grades

//This do for loop is simply counting the number of grades of each catagory posted.
do {
    printf("Enter a grade (Enter -1 to quit):");
    scanf("%f", &userInput);
    printf("You entered: %.1f\n", userInput);
    if ((userInput > 100) || (userInput < 0)) { //Over 100 is impossible.
        invalidGrade = invalidGrade + 1; …
Run Code Online (Sandbox Code Playgroud)

c printf while-loop do-while

0
推荐指数
1
解决办法
71
查看次数

标签 统计

c ×1

do-while ×1

printf ×1

while-loop ×1