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

int test3(char *A, char *B, char *C);
int test2(char *A, char *B, int a, int b, int i);

int main() {
    char plyr1[50];
    char plyr2[50];
    char plyr3[50];
    printf("rentrez le nom de l'utilisateur 1 : \n");
    fgets(plyr1,50,stdin);
    printf("rentrez le nom de l'utilisateur 2 : \n");
    fgets(plyr2,50,stdin);
    printf("rentrez le nom de l'utilisateur 3 : \n");
    fgets(plyr3,50,stdin);
    if (test3(plyr1,plyr2,plyr3))
        printf("c'est ordonné");
    else 
        printf("c'est pas ordonné");
}

int test3(char *A, char *B, char *C) {
    int i,ab,bc;
    int a=strlen(A); int b=strlen(B); int c=strlen(C);
    for (i=0;i<50;i++) {
        ab=strcmp(A[i],B[i]);bc=strcmp(B[i],C[i]);
        if (ab>0)
            return 0;
        if (bc>0)
            return 0;
        if (i==a)
            return test2(B,C,b,c,i);
        if (i==b)
            return 0;
        if (i==c)
            return 0;
    }
}

int test2(char *A, char *B, int a, int b, int i) {
    int ab=strcmp(A[i],B[i]);
    if (ab>0)
        return 0;
    if (a==i)
        return 1;
    if (b==i)
        return 0;
    return test2(A,B,a,b,i+1);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: