小编Tre*_*rey的帖子

strcmp将无法在if语句中正确评估

#include <stdio.h>
#include <math.h>
#include <string.h>
#define size 7

int computeN(char s1[])
    {
        int n=-1;

        if(strcmp(s1, "black") == 0)
        {
            n = 0;
        }
        else if (strcmp(s1, "brown") == 0)
        {
            n = 10;
        }
        else if (strcmp(s1, "red") == 0)
        {
            n = 20;
        }
        else if (strcmp(s1, "orange") == 0)
        {
            n = 30;
        }   
        else if (strcmp(s1, "yellow") == 0)
        {
            n = 40;
        }
        else if (strcmp(s1, "green") == 0)
        {
            n = 50;
        }
        else …
Run Code Online (Sandbox Code Playgroud)

c fgets strcmp

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

标签 统计

c ×1

fgets ×1

strcmp ×1