rtorres Posted May 2, 2008 at 11:31 AM Report Share #182986 Posted May 2, 2008 at 11:31 AM 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 More sharing options...
skm Posted May 2, 2008 at 12:39 PM Report Share #182995 Posted May 2, 2008 at 12:39 PM Ordena o teu array usando um algoritmo de ordenação. Bublesort, Quick sort, etc Depois é so listares o array. "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 More sharing options...
rtorres Posted May 2, 2008 at 01:45 PM Author Report Share #183007 Posted May 2, 2008 at 01:45 PM Poderiam Postar um Exemplo, ainda iniciei esta linguagem ontem! Obrigado Link to comment Share on other sites More sharing options...
skm Posted May 2, 2008 at 02:23 PM Report Share #183015 Posted May 2, 2008 at 02:23 PM 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now