Pluftt Posted October 25, 2007 at 06:45 PM Report Share #142876 Posted October 25, 2007 at 06:45 PM precisava k m ajudassem num prog em C++ e um prog k tira os espaços a mais d uma string por exemplo: "Escola Sa Miranda" tem k fikar "Escola Sa Miranda" agradecia k m ajudassem cumps Link to comment Share on other sites More sharing options...
Rui Carlos Posted October 25, 2007 at 06:54 PM Report Share #142878 Posted October 25, 2007 at 06:54 PM Era boa ideia começares a fazer qualquer coisa (não fiques à espera que façam o trabalho por ti). Começa por pensar num algoritmo para o fazer, e depois tenta implementá-lo. Quando tiveres dúvidas específicas, podes colocá-las aqui. PS: Por acaso estudas no Sá de Miranda em Braga? Rui Carlos Gonçalves Link to comment Share on other sites More sharing options...
Pluftt Posted October 25, 2007 at 09:04 PM Author Report Share #142936 Posted October 25, 2007 at 09:04 PM pois s eu soubesse ate fazia mas como o stor n sabe explikar eu n peskei nd d C++ :s peço k m ajudem e k isto e pra entregar amanha pf PS:ya Sa Miranda d Braga sim senhor Link to comment Share on other sites More sharing options...
TheDark Posted October 25, 2007 at 09:57 PM Report Share #142955 Posted October 25, 2007 at 09:57 PM Então pensa no exercício sem associar a C++. Sabes o que são cadeias de caracteres? Ou strings? Desaparecido. Link to comment Share on other sites More sharing options...
Pluftt Posted October 26, 2007 at 04:19 PM Author Report Share #143048 Posted October 26, 2007 at 04:19 PM brigadinho mas agr ja tenhu a respost #include <stdio.h> #include <string.h> void main(void) { char pal [100]; char palavra [100]; int x, z = 0, k, w; int espaco=0; int y=0; strcpy(pal,"escola sa miranda"); for (x = 0; pal[x]; x++) { palavra[z]=pal[x]; z++ ; espaco = 0 ; w = x ; while (pal[w]==32) { espaco++; w++ ; } if (espaco==1) palavra[z]=' ' ; else if (espaco > 1) for (k = 0; k < espaco - 1; k++) x++; } palavra[z] = pal[x]; printf("%s\n",palavra); } pra km precisar cumps :w 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