Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define WORD_MAX_LENGTH 256
- #define PLAYERS_MAX_COUNT 256
- int main(int argc, char *argv[])
- {
- char players[PLAYERS_MAX_COUNT][WORD_MAX_LENGTH];
- int c;
- int char_count, number_of_loaded_players = 0;
- // načtení jmen hráčů
- do {
- char_count = 0;
- do {
- if((c = getchar()) != '\n')
- players[number_of_loaded_players][char_count++] = c;
- } while(c != '\n');
- number_of_loaded_players++;
- } while(char_count > 0);
- // korekce počtu načtených hráčů
- number_of_loaded_players--;
- // výpis matice každý s každým
- int i, j;
- printf("Vypis zapasu:\n");
- for(i = 0; i < number_of_loaded_players; ++i) {
- for(j = i + 1; j < number_of_loaded_players; ++j) {
- printf("%s, %s\n", players[i], players[j]);
- }
- }
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement