Update progress to 1-20

This commit is contained in:
caskd 2019-10-13 17:59:06 +02:00
parent ce1219d78e
commit bf8636944c
No known key found for this signature in database
GPG Key ID: 79DB21404E300A27
3 changed files with 92 additions and 6 deletions

View File

@ -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

BIN
main

Binary file not shown.

75
main.c
View File

@ -1,4 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// // 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';
// }
// }