diff --git a/zsiKOD b/zsiKOD new file mode 100644 index 0000000..dd0bfb7 --- /dev/null +++ b/zsiKOD @@ -0,0 +1,136 @@ +#include +#include +#include +#include +#include + +/* run this program using the console pauser or add your own getch, system("pause") or input loop */ + +int compare(const void *a, const void *b) +{ + const char **pa,**pb; + + pa = (const char **)a; + pb = (const char **)b; + return( strcmp(*pa,*pb) ); +} + +int main() { + + int pocet_slov,pocet_znakov=0,i=0,count=0,number=0; + bool zhoda=false; + char* pole_smernikov[1000]={0}; + char line[1000]; + + char cislo[1000]; + fgets(cislo,1000,stdin); + int dlzka=strlen(cislo); + for(i=0;i='A' && line[i]<='Z')count++; + if(line[i]>='a' && line[i]<='z')count++; + } + if(count==0){ + //printf("Koniec"); + break; + } + int size = (int)strlen(line); + size--; + while(size!=-1){ + if(line[size]==' ' || line[size]=='\n' || line[size]==' '){ + line[size]='\0'; + } + else{ + break; + } + size--; + } + //printf("Retazec: #%s#\n",line); + for(i=0;i0){ + puts("Prijati studenti:"); + for (i = 0; i < pocet_slov; i++){ + printf("%s\n",pole_smernikov[i]); + } + } + else{ + puts("Prijati studenti:"); + for (i = 0; i < number; i++){ + printf("%s\n",pole_smernikov[i]); + } + puts("Neprijati studenti:"); + for (i = number; i < pocet_slov; i++){ + printf("%s\n",pole_smernikov[i]); + } + } + + for (i = 0; i < pocet_slov; i++){ + free(pole_smernikov[i]); + } + + return 0; +} \ No newline at end of file