fork(1) download
  1. #include <stdio.h>
  2.  
  3. int contem(char s1[], char s2[]) {
  4. for (int i = 0; s2[i]; i++) {
  5. int j;
  6. for (j = 0; s1[j]; j++) if(s2[i] == s1[j]) break;
  7. if (s1[j] == '\0') return 0;
  8. }
  9. return 1;
  10. }
  11.  
  12. int main() {
  13. char s[] = "abc";
  14. char v[] = "cdeabf";
  15. if (contem(v, s)) printf("'%s' contém todos os caracteres presentes em '%s'", v, s);
  16. else printf("'%s' não contém todos os caracteres presentes em '%s'", v, s);
  17. }
  18.  
  19. //https://pt.stackoverflow.com/q/54324/101
Success #stdin #stdout 0s 4340KB
stdin
Standard input is empty
stdout
'cdeabf' contém todos os caracteres presentes em 'abc'