Juin Posted January 4, 2010 at 01:04 AM Report Share #304002 Posted January 4, 2010 at 01:04 AM qual é o melhor modo de comparar duas com um if... usei assim mas nao ta certo... for(i=0; i<index-1; i++) for(j=0; j<index; j++){ if(i != j) if (strcmp(dados[i].titulo, dados[j].titulo)==0){ printf("Resposta Repetida!\n"); --index; LerProposta(index); } } Link to comment Share on other sites More sharing options...
TheDark Posted January 4, 2010 at 02:47 AM Report Share #304005 Posted January 4, 2010 at 02:47 AM "nao ta certo" é imensamente vago. O código que deixaste aí também não ajuda muito. titulo tem o tipo correcto? O que é que "nao ta certo"? O conteúdo de titulo é o que esperas? Confirmaste em debug? Desaparecido. Link to comment Share on other sites More sharing options...
Localhost Posted January 4, 2010 at 04:49 PM Report Share #304067 Posted January 4, 2010 at 04:49 PM Para comparares strings usas o strcmp mas com um !. Do género: if(!(strcmp(teste,"ola"))){ (...) } here since 2009 Link to comment Share on other sites More sharing options...
TheDark Posted January 4, 2010 at 06:20 PM Report Share #304097 Posted January 4, 2010 at 06:20 PM Fazer isso ou comparar com 0 tem o mesmo resultado. Desaparecido. Link to comment Share on other sites More sharing options...
Localhost Posted January 6, 2010 at 12:13 PM Report Share #304444 Posted January 6, 2010 at 12:13 PM Ah sim, não tinhas visto o == 0 here since 2009 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