mino2580

task2_kombinace_hracu

Apr 19th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main( )
  5. {
  6.  
  7. //pokracovanie
  8.  
  9. // puts("zadej pocet hracu:");
  10. int pocet=0;
  11. char jmenaHracu[256][256];
  12.  
  13. while(fgets(jmenaHracu[pocet],256,stdin)!=NULL)
  14. {
  15. char*jmeno=jmenaHracu[pocet];
  16.  
  17. int indexKonce=strlen(jmeno)-1;
  18. jmeno[indexKonce]=0;
  19. pocet++;
  20. }
  21.  
  22. for(int i=0;i<pocet-1;i++)
  23. for(int j=i+1;j<pocet;j++)
  24. printf("%s,%s\n",jmenaHracu[i],jmenaHracu[j]);
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment