From 02253d0d43dd5c51c74e304f7cdd5344b08a502b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Cabra?= Date: Mon, 13 May 2019 09:27:51 +0000 Subject: [PATCH] =?UTF-8?q?P=C5=99idat=20'zsiKOD'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsiKOD | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 zsiKOD 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