未知的转换类型字符

时间:2014-06-23 19:43:16

标签: c

我之前没有得过这个,我不知道如何解决它,请帮忙。

#include <stdio.h>
#include <stdlib.h>

int Health;
int Level;
int rnd;
int rnd2;
int counter;

int main(int argc, char* argv[]) {

    counter = 1;
    Health = 100;
    Level = 1;

    while(counter < 2){
        if(Health <= 0){
             break;
        }
        else if(Health > 100){
            Health = 100;
        }
        system("clear");
        printf("Health:%d%\nLevel:%d\n", Health, Level);
        scanf("%d %d", &rnd, &rnd2);
        if(rnd == 1){
            Health = Health - rnd2;
        }
        else if(rnd == 2){
            Level = Level + rnd2;
        }
    }
    system("clear");
    printf("\n\nYou Died!\n\n");
return 0;
}

这就是终端所说的:

Health-Level.c:在函数'main'中: Health-Level.c:24:3:警告:格式为[-Wformat]

的未知转换类型字符0xa

1 个答案:

答案 0 :(得分:2)

变化:

"Health:%d%\nLevel:%d\n"

"Health:%d\nLevel:%d\n"