Jump to content

Listar por ordem alfabética e por decrescente


rtorres
 Share

Recommended Posts

Gostava de saber como se faz uma listagem por ordem alfabética, por exemplo dos nomes em C, num array.

Exemplo: Esta funcao lista todos os nomes

while (conta<qtd)

{

      total_idades = printf("Nome: %s\n", raca[conta].nome);

      conta++;

}

e tb por ordem decrescente, que pode ser por exemplo a idade.

while (conta<qtd)

{

      total_idades = printf("Nome: %i\n", raca[conta].idade);

      conta++;

}

Poderiam-me ajudar que comecei a pouco a programar nesta linguagem C.

Obrigado

Link to comment
Share on other sites

Existem alguns topicos de sobre ordenação aqui no forum so tens que procurar.

http://www.portugal-a-programar.pt/index.php?showtopic=1025

Pelo que disse ja tens tudo o que necessitas para fazer o trabalho. Ninguem o vai fazer por ti.  😉

"There are two kinds of programmers. Those who write something to get the work done and those who want to write good code."João BrandãoWebsite e blog: http://jamab.blogspot.com/

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.