From d61f3476632becc3a4ddc45a0f71e3d3418ab91c Mon Sep 17 00:00:00 2001 From: Didnt Read Readme Date: Wed, 23 Mar 2022 16:14:51 +0100 Subject: [PATCH] P05-Sorter --- P05_TicTacToe/work/sorter/a.out | 0 P05_TicTacToe/work/sorter/sorter | Bin 0 -> 12680 bytes P05_TicTacToe/work/sorter/sorter.c | 62 +++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 P05_TicTacToe/work/sorter/a.out create mode 100755 P05_TicTacToe/work/sorter/sorter create mode 100644 P05_TicTacToe/work/sorter/sorter.c diff --git a/P05_TicTacToe/work/sorter/a.out b/P05_TicTacToe/work/sorter/a.out new file mode 100644 index 0000000..e69de29 diff --git a/P05_TicTacToe/work/sorter/sorter b/P05_TicTacToe/work/sorter/sorter new file mode 100755 index 0000000000000000000000000000000000000000..b1f699f1fb4cfb8350a1e81ea760d37144f886d4 GIT binary patch literal 12680 zcmeHNeQX@X6`%9ji9?dJ6Y}9CKo&|+LYs}9PbU!S^He{4J6CiceYR1ch=or zu_Hv&nu~mL9r6cM`KOX8Z3V4V;18nEme#>(99pRjR0Y&h$)ycF^C8Svno^SM@6FCT z@2$@S_2a)AY4^?h&3kWV-ptO3ipDNUUiWTxal=Yjw!d0Xo)JzN6LLR%2WtV0;ET6 z9k^Dqpqk8NscOeDMOlwn(mSs7jw?N;ld54%xqs9*x>}SyH?2n*C8i`xY0r5pNcpq# zBs-1XYQusl>wOh^)XvYF%9Y?=Ro_g0=~eA#s=6!Ib%k3uZ(P?ET-z0nBzo8OR&QRr zd7~bW>g#2{$v(;M*tJjAMB~k_r8Y0ZMHrQzA6ZuPe(zI{o_NIi`_H!w4FBrV**&Do z7qXu_9fhQpM|v)>g?aGXX27qX0l#Sme9H{@Ju~3sm3-~_5pWHcJCSTY`R9OZZej3^ zxNgXU3yfPE4bx^3w_XMH4+ep%}{BdIM&AI1=az9|}oJ-913bIH|@gvpW!uh#k#MwRPrteM>gCF`HYj zZxUux%T6;Gii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+Ql~!e_n98f(WZB-otQoX z)~T33cF{9b3eo*kzQaJ_8rahE=SXE5dOYnFHS|4F6K9?#=UcC!|4WxXf8S)OYr?bN*evaXX^YL@_q-qGxM;UL^GyE$-7<$he=i+V zapNop5t*20`WK)y_qcxkuHv|JjxXo=$$C7F^j$$+WPSe6GO!XLQm;+2ch+b67D}A@ z+5M|#t8hJRfc2Q4M20Y~pZ9&`nl0g$cMXU57-ED~+Tz(e>#xZoc82wxl;@sPv_`YJ vUgbD?&(L0%+r#T8&2MhItzq9!-el83mvOF_WfvfmPrptz{4xtF>el}^m64(F literal 0 HcmV?d00001 diff --git a/P05_TicTacToe/work/sorter/sorter.c b/P05_TicTacToe/work/sorter/sorter.c new file mode 100644 index 0000000..fb1d18d --- /dev/null +++ b/P05_TicTacToe/work/sorter/sorter.c @@ -0,0 +1,62 @@ +#include +#include +#define numWords 10 +#define lenWords 20 + +int toupper(int ch); + +int main(void) +{ + char words[numWords][lenWords] = {0}; + int readFinished = 0; + for(int i = 0; i < numWords; i++){ + char word[lenWords] = {}; + if(readFinished == 0){ + int newWord = 0; + while(newWord == 0 && readFinished == 0){ + printf("%d. Next Word: ", i); + scanf("%s", word); + for(int k = 0; k < lenWords; k++) + { + word[k] = toupper(word[k]); + } + if(strcmp("ZZZ", word) == 0){ + readFinished = 1; + printf("Finished reading...\n"); + } + else{ + newWord = 1; + for(int j = 0; j < i; j++){ + if(strcmp(word, words[j]) == 0){ + newWord = 0; + printf("Word was already in List.\n"); + } + + } + if(newWord == 1){ + strcpy(words[i], word); + } + } + + } + + } + } + + char temp[lenWords]; + for(int i=0;i0){ + strcpy(temp,words[i]); + strcpy(words[i],words[j]); + strcpy(words[j],temp); + } + } + + + printf("Sorted Words:\n"); + for(int i = 0; i < numWords; i++){ + printf("%s\n", words[i]); + } + +}