From bf8636944c73a44a1256719e378d4ea92b895aa7 Mon Sep 17 00:00:00 2001 From: caskd Date: Sun, 13 Oct 2019 17:59:06 +0200 Subject: [PATCH] Update progress to 1-20 --- .kdev4/LearningC.kdev4 | 23 +++++++++++++ main | Bin 16728 -> 0 bytes main.c | 75 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 92 insertions(+), 6 deletions(-) delete mode 100755 main diff --git a/.kdev4/LearningC.kdev4 b/.kdev4/LearningC.kdev4 index d3e17e6..39e3f98 100644 --- a/.kdev4/LearningC.kdev4 +++ b/.kdev4/LearningC.kdev4 @@ -15,5 +15,28 @@ Extra Arguments= Install Directory= Runtime=Host System +[Cppcheck] +checkPerformance=true +checkPortability=true +checkStyle=true + +[Launch] +Launch Configurations=Launch Configuration 0 + +[Launch][Launch Configuration 0] +Configured Launch Modes=execute +Configured Launchers=nativeAppLauncher +Name=New Compiled Binary Launcher +Type=Native Application + [Project] VersionControlSupport=kdevgit + +[SourceFormatter] +text/x-c++hdr=kdevcustomscript||GNU_indent_GNU +text/x-c++src=kdevcustomscript||GNU_indent_GNU +text/x-chdr=kdevcustomscript||GNU_indent_GNU +text/x-csharp=kdevcustomscript||GNU_indent_GNU +text/x-csrc=kdevcustomscript||GNU_indent_GNU +text/x-java=kdevcustomscript||GNU_indent_GNU +text/x-objcsrc=kdevcustomscript||GNU_indent_GNU diff --git a/main b/main deleted file mode 100755 index 48241d1a4deb317c2e986df529d5ec8d332a8c18..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16728 zcmeHOZ){W76~B%X2$a}{hBgCMJO)x|6%$IxLTOq%#Nnk&Af*Xi8STTdoy2NlGyAzs z(9qZnEmoSA4^-{8N=%!?=!Z$uG$E$7n+pi2G<9JgHnw$YsOTD2)(m+`utt8wD6!ne~-%6K}98>lXDeBFZYS1A_Oa-+A^(v4- zWh;FT9fHJ^`T6?1k}ZUV4xj)ere-~Kq0;)I;)2 zIi463{G2Afm9_#86H}DM)b*Yg!T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FV@p$>%N5xm~BqX}-~ zz-_B&sw*4=<-!{~GwKb%gNs4=Mq<^*RUN+0Gb1aVQ+rb>5}=Dc;Z$0-{~zBsGA;q3 zEOrglYPl3-sb)t*II(-AEBpvXzW7#C$(u{Uml_$;LcKt>q(KKb2N#s0$=$*iPiRqJ ze?0B$O~>FqS}a0PpryS|3-t@h8wjNagfB7@2YUw9k_P9gXfhQ`#0v^4@RHHN5Gqh^ z_n;c>e zhw#Ci7=m$bp4|UI9`^_EYJl$$Bk_8VDen)6EoC{6^z-n+H970^x{&Eg6fz}#zcbVb z8M8jGADMbtkf>F^74W~n8lCIseG60epWk=9UtqIaAcK1r*5~yo(+ebs`yPxF>+}9% zJ7BmsV14+qHxg0a7ZF+%zbAl!dl1&=^(|BWj%EK@j_H%2k9!&}Pf)!~>#1U^|Lo5m z$e;@A^Lm+Sjs&@WYy0<;ehbNslOR*Yqz|izqWIzWF2)u8lZn?cM0x+pY-%1CMHX^q zeJ|-T_2(sxjK#b-Y|-CE0!-7EjUVf?*>73&dEL*H_vb8c_5VAh&+!*tk|fIeYeMtG zi_6C#gY9R1-bXNPWkI6W`j1=mdB4H52928%_di29$hhFcVdC{8-y62dbD8NcKo?ej zd41l$aMQ7n{iXydSzi3%^?6nG@?X z{Ub2V`od4r^#&zEV6p!n0mrP*>&1FfWIx#e*URM_kU@<7_xlZwpY*NrSeH3{3I)Wh zezHC-v-2vfZ>Bu<@ +#include +#include // // PART OF 1-5, 1-15 // #define LOWER 0 @@ -8,9 +10,11 @@ // // PART OF 1-15 // float convert2cels(int fahr); -// // PART OF 1-16, 1-17 -// #define MAXLINE 1000 +// // PART OF 1-16, 1-17, 1-18, 1-19, 1-20 +#define MAXLINE 1000 // int getlines(char line[], int maxline); +int detab(char s[],int lim, int col); +// void reverse(char s[MAXLINE], char d[strlen(s)]); // void copy(char to[], char from[]); int main() { @@ -191,16 +195,34 @@ int main() { // } // } // } -// printf("\"%s\"\n", prostr); -// return 0; -// } +// printf("\"%s\"\n", prostr);\ + +// // 1-19 +// char d[MAXLINE]; +// char line[MAXLINE]; +// int len; +// while ((len = getlines(line,MAXLINE)) > 0) { +// reverse(line, d); +// printf("\nOriginal: %s\nReversed: %s\n", line, d); +// } + +// // 1-20 +// int len; +// char line[MAXLINE]; +// while ((len = detab(line,MAXLINE,8)) > 0) { +// printf("%s", line); +// } + + + return 0; +} // // PART OF 1-15 // float convert2cels(int fahr) { // return (5.0/9.0) * (fahr-32.0); // } -// // PART OF 1-16, 1-17, 1-18 +// // PART OF 1-16, 1-17, 1-18, 1-19 // int getlines(char s[],int lim) { // int c, i; // for (i=0; i < lim-1 && (c=getchar())!=EOF && c!='\n'; ++i) @@ -212,6 +234,38 @@ int main() { // s[i] = '\0'; // return i; // } + +// // PART OF 1-20 +// int detab(char s[],int lim, int col) +// /*s is the string we need to replace, lim is the character limit +// * and col is the size of a tab (8 characters usually so we use that)*/ +// { +// int c, i; /*c is the character integer representation and i is the column we are on*/ +// for (i=0; i < lim-1 && (c=getchar())!=EOF && c!='\n';) +// if (c == '\t') { +// int sp=col-i%col; /*Amount of spaces to replace the tab with*/ +// int st=i; /*Starting point*/ +// for (int co = 0; co<=sp; co++ && i++) { +// /*For each space we need to add, we increase the column count and add it +// *to the array at position (starting point + spaces added so far) +// * and we increase the spaces added so far*/ +// s[st+co] = ' '; +// } +// } else { +// s[i] = c; +// ++i; +// } +// if (c == '\n') +// /*If it is the end of the string, represented by a new line, +// * add that new line and increase it for the \0 addition*/ { +// s[i] = c; +// ++i; +// } +// /*Add the string end and return it to the previous context*/ +// s[i] = '\0'; +// return i; +// } + // /* copy: copy 'from' into 'to'; assume to is big enough */ // void copy(char to[], char from[]) { // int i; @@ -219,3 +273,12 @@ int main() { // while ((to[i] = from[i]) != '\0') // ++i; // } + +// // PART OF 1-19 +// void reverse(char s[MAXLINE], char d[strlen(s)+1]) { +// int len = strlen(s); +// for (int i=--len; i >= 0; --i) { +// d[len-i] = s[i]; +// d[len+1] = '\0'; +// } +// }