设置带有字符的 if 语句?

Setting up an if statement with characters?

这是我的代码:

#include <stdio.h> 
#include <string.h>

int main() 
{

    char input[99];
    int i, i2, i3, n;

    while(1) 
    {

    i = 0;
    i2 = 1;
    i3 = 2;
    n = 0;

        printf("I can recognize if you are laughing or not, please type in a string. Type \"bye\" to quit: ");

        scanf("%s", input);

        printf("\n");

        if(strcmp(input, "bye") == 0) 
        {
            printf("Bye now!\n");
            break;
        }

        int length_input = strlen(input);
    char h = h;
    char a = a;
    char o = o;
    char x = !;  

    printf("Your input is: %s\n", input);

        for(; i < length_input; (i+2)) 
        {

            if(input[i] !== h) // is not laughing? or to say: if input[i] =/= h then not laughing.
            {
                printf("You are not laughing...\n");
                i2 = length_input;
                n = 1;
                i = length_input;
                i3 = length_input;
            }

        }

    for(; i2< length_input; (i2+2))
    {

        if(input[i2] !== a || o || x) // is not laughing? or to say: if input[i] =/= a, o, or ! then not laughing.
        {
            printf("You are not laughing...\n");
            i2 = length_input;
            n = 1;
            i3 = length_input;
        }

    }

    for(; i3 < length_input; (i3+3)) 
    {
        if(input[i3] == x) //is laughing? or to say: if input[i2] = ! then laughing
        {
            printf("You are laughing!\n");
            i3 = length_input;
            n = 1;
        }   

    }

    if(n == 0)
    {
        printf("You are not laughing...\n");
    }


        printf("\n");        
    }
}

正如标题所说,我认为我的问题主要出现在 if 语句中。特别是在它说 input[i] !== h, input[i] !== a || 的地方o || x 等。非常感谢任何帮助修复我的代码的功能。

代码应阅读的示例如下:

I can recognize if you are laughing or not, please type in a string: ha!

Your input is: ha!

You are laughing!

I can recognize if you are laughing or not, please type in a string: haha!

Your input is: haha!

You are laughing!

I can recognize if you are laughing or not, please type in a string: ho!

Your input is: ho!

You are laughing!

I can recognize if you are laughing or not, please type in a string: hohohaha!

Your input is: hohohaha!

You are laughing!

I can recognize if you are laughing or not, please type in a string: haa!

Your input is: haa!

You are not laughing...

I can recognize if you are laughing or not, please type in a string: ha!!

Your input is: ha!!

You are not laughing...

I can recognize if you are laughing or not, please type in a string: ha!ha

Your input is: ha!ha

You are not laughing...

I can recognize if you are laughing or not, please type in a string: bye

Bye now!

因为这似乎是 C,所以您需要使用 != 代替 !==。此外,如果您想查看变量 x 是否不等于变量 y 或变量 z,请使用 && 分隔的两个不同的比较。示例:x != y && x != z