Responder dúvida

Seja o primeiro a responder

Exercício de string

Computação Geral string Programação sistemas de informação
Eu quero comparar e ver qual das 3 strings é a maior , só que ainda não consegui fazer isso, to indo no caminho certo ? #include #include #include #define TAM 30 #define TAM1 30 #define TAM2 30 int main() { char str1[TAM], str2[TAM1], str3[TAM2]; int comp; printf("Informe o primeiro nome "); scanf("%[^\n]", str1); fflush(stdin); printf("Informe o segundo nome "); scanf("%[^\n]", str2); fflush(stdin); printf("Informe o terceiro nome "); scanf("%[^\n]", str3); comp = strcmp(char str1 , str2 ); if (comp > 0){ printf(" a maior string eh : %s \n ", str1); } else if (comp < 0){ printf(" a maior string eh : %s \n ", str2); } else{ printf(" a maior string eh : %s \n ", str3); } return 0; }
Foto de Nayara S.
Nayara perguntou há 5 anos