2020-04-16 07:39:38 +00:00
|
|
|
/******************************************************************************
|
|
|
|
|
|
|
|
Welcome to GDB Online.
|
|
|
|
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
|
|
|
|
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
|
|
|
|
Code, Compile, Run and Debug online from anywhere in world.
|
|
|
|
|
|
|
|
*******************************************************************************/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#define fullSIZE 1000
|
|
|
|
#define wSIZE 100
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int SIZE = 0;
|
|
|
|
if(!(scanf("%d", &SIZE))){
|
|
|
|
printf("Nespravny vstup\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if(SIZE < 1){
|
|
|
|
printf("Nespravny vstup\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int pm = 0;
|
|
|
|
char** pole_smernikov = malloc(fullSIZE * sizeof(char));
|
|
|
|
int k = 0;
|
|
|
|
char* line = malloc(wSIZE * sizeof(char));
|
2020-04-16 07:48:26 +00:00
|
|
|
size_t pocet_znakov = 0;
|
2020-04-16 08:02:03 +00:00
|
|
|
int antiInfC = 0;
|
2020-04-16 08:28:29 +00:00
|
|
|
char r = 'a';
|
2020-04-16 10:20:24 +00:00
|
|
|
while (fgets(line,wSIZE,stdin)) {
|
2020-04-16 07:48:26 +00:00
|
|
|
k = 0;
|
2020-04-16 07:39:38 +00:00
|
|
|
pocet_znakov = strlen(line);
|
|
|
|
char* all = malloc(pocet_znakov);
|
|
|
|
memcpy(all, line, pocet_znakov);
|
|
|
|
for(int x = 0; x < pm; x++){
|
|
|
|
if(memcmp(pole_smernikov[x], line, pocet_znakov) == 0){
|
|
|
|
k++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(0 == k){
|
|
|
|
pole_smernikov[pm] = all;
|
|
|
|
pm++;
|
|
|
|
}
|
2020-04-16 08:29:31 +00:00
|
|
|
if(antiInfC == 0){
|
|
|
|
antiInfC++;
|
|
|
|
continue;
|
|
|
|
}
|
2020-04-16 08:28:29 +00:00
|
|
|
if((line[0] == '\n' || isalpha(line[0])!=0 ) && antiInfC == 1 && r == '\n') {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
r = line[0];
|
2020-04-16 07:39:38 +00:00
|
|
|
}
|
2020-04-16 07:48:26 +00:00
|
|
|
free(line);
|
2020-04-16 07:39:38 +00:00
|
|
|
k = 0;
|
|
|
|
int i = 0;
|
|
|
|
i = 0;
|
|
|
|
while (i < pm){
|
|
|
|
for(int j = 0+1; j < pm-i; j++){
|
|
|
|
if(0 < strcmp(pole_smernikov[j-1], pole_smernikov[j])){
|
|
|
|
char* temp = pole_smernikov[j];
|
|
|
|
pole_smernikov[j] = pole_smernikov[j - 1];
|
|
|
|
pole_smernikov[j-1] = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
if(NULL == pole_smernikov[1]){
|
|
|
|
puts("Ziadne prihlasky");
|
|
|
|
return 0;
|
|
|
|
}
|
2020-04-16 08:23:17 +00:00
|
|
|
puts("Prijati studenti:");
|
2020-04-16 07:58:37 +00:00
|
|
|
for(int i = 0+1; i < 1+SIZE; i++){
|
2020-04-16 07:42:17 +00:00
|
|
|
if(pole_smernikov[i] != NULL){
|
2020-04-16 08:23:17 +00:00
|
|
|
printf("%s", pole_smernikov[i]);
|
2020-04-16 07:42:17 +00:00
|
|
|
} else{
|
|
|
|
|
2020-04-16 07:39:38 +00:00
|
|
|
}
|
|
|
|
free(pole_smernikov[i]);
|
|
|
|
}
|
|
|
|
int rra = -1;
|
|
|
|
pm = pm + rra;
|
|
|
|
if(0 > (SIZE - pm)){
|
|
|
|
puts("Neprijati studenti:");
|
|
|
|
for(int i = SIZE+1; i<pm+1; i++){
|
2020-04-16 08:23:17 +00:00
|
|
|
printf("%s", pole_smernikov[i]);
|
2020-04-16 07:39:38 +00:00
|
|
|
|
|
|
|
free(pole_smernikov[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(pole_smernikov);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|