Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #define MAX_VALUE 32
- void Ordem(int quant_name, int nivel);
- int main() {
- int quant, nivel;
- scanf("%d", &quant);
- scanf("%d", &nivel);
- Ordem(quant, nivel);
- return 0;
- }
- void Ordem(int quant_name, int nivel) {
- int cont, i, j;
- char nomes[quant_name][MAX_VALUE] ;
- for(i=0; i<quant_name; i++) {
- scanf("%s", nomes[i]);
- }
- for(i=0; i < quant_name; i++) {
- for(j=i; j < quant_name; j++) {
- if((strcmp(nomes[i], nomes[j])) > 0) {
- char __aux_name[MAX_VALUE];
- strcpy(__aux_name, nomes[i]);
- strcpy(nomes[i], nomes[j]);
- strcpy(nomes[j], __aux_name);
- }
- }
- }
- printf("%s", nomes[nivel-1]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement