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

int test3(char[50] plyr1, char[50] plyr2, char[50] plyr3);
int test2(char[50] plyr1, char[50] plyr2, int i, int lmini);
int min(int n1, int n2);

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 rangé dans l'ordre alphabetique\n\n");
    else 
        printf("c'est pas dans l'ordre alphabetique\n\n");
}

int test3(char[50] plyr1, char[50] plyr2, char[50] plyr3) {
    int lmini = min(strlen(plyr1),strlen(plyr2));
    int i;
    for (i=0,i<lmini,i++) {
        if (strcmp(plyr1[i],plyr2[i])<0) {
            if (strcmp(plyr2[i],plyr3[i])<0)
                return 1;
            else
                return test2(plyr2,plyr3,i,min(strlen(plyr2),strlen(plyr3))-i);
        }
        else {
            if (strcmp(plyr2[i],plyr3[i])<0)
                return test2(plyr1,plyr2,i,min(strlen(plyr1),strlen(plyr2))-i);
        }
    }
    if (strlen(plyr1)==lmin)
        return test2(plyr2,plyr3,i,min(strlen(plyr2),strlen(plyr3))-i);
    if (strlen(plyr2)==lmin)
        return test2(plyr1,plyr3,i,min(strlen(plyr1),strlen(plyr3))-i);
    return test2(plyr1,plyr2,i,min(strlen(plyr1),strlen(plyr2))-i);
}

int test2(char[50] plyr1, char[50] plyr2, int i, int lmini) {
    int n;
    for (i=i;i<lmini;i++){
        if (strcmp(plyer1,plyr2)<0)
            return 1;
        
    }
}

int min(int n1, int n2) {
    if (n1<n2)
        return n1;
    return n2;
}

if ((strcmp(plyr1,plyr2)<0) && (strcmp(plyr2,plyr3)<0))
        printf("c'est rangé dans l'ordre alphabetique\n\n");
    else 
        printf("c'est pas dans l'ordre alphabetique\n\n");

Embed on website

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