Update progress and completion of 1-18

This commit is contained in:
caskd 2019-10-11 21:40:50 +02:00
parent 12c295e8e6
commit ce1219d78e
No known key found for this signature in database
GPG Key ID: 79DB21404E300A27
3 changed files with 83 additions and 2 deletions

View File

@ -1,2 +1,19 @@
[Buildset]
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x12\x00L\x00e\x00a\x00r\x00n\x00i\x00n\x00g\x00C)
[CMake]
Build Directory Count=1
Current Build Directory Index-Host System=0
[CMake][CMake Build Directory 0]
Build Directory Path=/home/caskd/Projects/LearningC/build
Build Type=Debug
CMake Binary=/usr/bin/cmake
CMake Executable=/usr/bin/cmake
Environment Profile=
Extra Arguments=
Install Directory=
Runtime=Host System
[Project]
VersionControlSupport=kdevgit

BIN
main Executable file

Binary file not shown.

68
main.c
View File

@ -8,6 +8,11 @@
// // PART OF 1-15
// float convert2cels(int fahr);
// // PART OF 1-16, 1-17
// #define MAXLINE 1000
// int getlines(char line[], int maxline);
// void copy(char to[], char from[]);
int main() {
// // 1-1
// printf("Hello, World!\n");
@ -148,10 +153,69 @@ int main() {
// celsius = celsius + STEP;
// }
return 0;
}
// // 1-16
// int len;
// /* current line length */
// int max;
// /* maximum length seen so far */
// char line[MAXLINE];
// /* current input line */
// char longest[MAXLINE];
// /* longest line saved here */
// max = 0;
// while ((len = getlines(line, MAXLINE)) > 0)
// if (len > max) {
// max = len;
// copy(longest, line);
// }
// if (max > 0) /* there was a line */
// printf("Character count: %d\n%s", max, longest);
// // 1-17
// char line[MAXLINE];
// int len;
// while ((len = getlines(line,MAXLINE)) > 0) {
// if (len > 80)
// printf("%s", line);
// }
// // 1-18
// char line[MAXLINE], prostr[MAXLINE];
// int len;
// int skip = 0;
// while ((len = getlines(line, MAXLINE)) > 0) {
// for (int i=len; !(i < 0); --i) {
// if (skip != 0 || !(line[i] == ' ' || line[i] == '\n' || line[i] == '\t' || line[i] == '\0')) {
// prostr[i] = line[i];
// skip = 1;
// }
// }
// }
// printf("\"%s\"\n", prostr);
// 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
// int getlines(char s[],int lim) {
// int c, i;
// for (i=0; i < lim-1 && (c=getchar())!=EOF && c!='\n'; ++i)
// s[i] = c;
// if (c == '\n') {
// s[i] = c;
// ++i;
// }
// s[i] = '\0';
// return i;
// }
// /* copy: copy 'from' into 'to'; assume to is big enough */
// void copy(char to[], char from[]) {
// int i;
// i = 0;
// while ((to[i] = from[i]) != '\0')
// ++i;
// }