From e3b1991306427e918d90ec357dcedd9b05f2b75d Mon Sep 17 00:00:00 2001 From: Goodwitch68 <56366861+Goodwitch68@users.noreply.github.com> Date: Tue, 22 Oct 2019 14:54:54 +0200 Subject: [PATCH 01/17] TYC_Hour_2 HW --- helloworld/TYC_Hour_2 | 1 + 1 file changed, 1 insertion(+) create mode 100644 helloworld/TYC_Hour_2 diff --git a/helloworld/TYC_Hour_2 b/helloworld/TYC_Hour_2 new file mode 100644 index 0000000..888db58 --- /dev/null +++ b/helloworld/TYC_Hour_2 @@ -0,0 +1 @@ +//Ezek szerint itt is lehet kódolni, közvetlenül? From 16e4873ce706b7c719e767320891765bb49ef7fb Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Tue, 22 Oct 2019 15:43:32 +0200 Subject: [PATCH 02/17] H2_E2 done --- helloworld/H2_E2.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 helloworld/H2_E2.c diff --git a/helloworld/H2_E2.c b/helloworld/H2_E2.c new file mode 100644 index 0000000..68bb16f --- /dev/null +++ b/helloworld/H2_E2.c @@ -0,0 +1,9 @@ +#include +#include + +void main() +{ + printf ("It's fun to write my own program in C.\n"); + exit(0); + +} \ No newline at end of file From 228e62fca79464882248fe25f675b031ddf525d7 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Tue, 22 Oct 2019 15:44:02 +0200 Subject: [PATCH 03/17] H2_E3 done --- helloworld/H2_E3.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 helloworld/H2_E3.c diff --git a/helloworld/H2_E3.c b/helloworld/H2_E3.c new file mode 100644 index 0000000..fbd9ef7 --- /dev/null +++ b/helloworld/H2_E3.c @@ -0,0 +1,9 @@ +#include +#include + +void main() +{ + printf ("\nHowdy, neighbor!\nThis is my first C program.\n"); + exit(0); + +} \ No newline at end of file From 3b8491d151a96fa42e0236b582f961f01b31d544 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Tue, 22 Oct 2019 16:22:00 +0200 Subject: [PATCH 04/17] H3_E5 done --- helloworld/H3_E5.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 helloworld/H3_E5.c diff --git a/helloworld/H3_E5.c b/helloworld/H3_E5.c new file mode 100644 index 0000000..55cb0ae --- /dev/null +++ b/helloworld/H3_E5.c @@ -0,0 +1,15 @@ +#include +/* This function multiplicate two integers and returns the result */ +int integer_mult( int x, int y ) +{ + int result; + result = x * y; + return result; +} +int main() +{ + int prod; + prod = integer_mult(3, 5); + printf("3 times 5 is %d.\n", prod); + return 0; +} \ No newline at end of file From cc595874b3c39e9ff57fb1dfffc42f4419920a5c Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Tue, 22 Oct 2019 17:55:14 +0200 Subject: [PATCH 05/17] H4_C1 done --- helloworld/H4_E1.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 helloworld/H4_E1.c diff --git a/helloworld/H4_E1.c b/helloworld/H4_E1.c new file mode 100644 index 0000000..9c6c601 --- /dev/null +++ b/helloworld/H4_E1.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + printf("The numeric value of Z is: %d, the same of z is: %d.", 'Z', 'z'); + return 0; +} \ No newline at end of file From e2548d6d254fe86f30aff2ab4dd40f5de5675104 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Tue, 22 Oct 2019 17:58:11 +0200 Subject: [PATCH 06/17] H4_C2 done --- helloworld/H4_E2.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 helloworld/H4_E2.c diff --git a/helloworld/H4_E2.c b/helloworld/H4_E2.c new file mode 100644 index 0000000..c9209b5 --- /dev/null +++ b/helloworld/H4_E2.c @@ -0,0 +1,7 @@ +#include + +int main() +{ + printf("The ASCII value of 72 is character: %c, the 104 is character: %c.", 72, 104); + return 0; +} \ No newline at end of file From 6bb2b864f6dda2fffb519d2985bcaaced4889ef9 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Tue, 22 Oct 2019 18:02:51 +0200 Subject: [PATCH 07/17] H4_C4 done --- helloworld/H4_E4.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 helloworld/H4_E4.c diff --git a/helloworld/H4_E4.c b/helloworld/H4_E4.c new file mode 100644 index 0000000..d43b81f --- /dev/null +++ b/helloworld/H4_E4.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + double dbl_num = 123.456; + printf("Floating is: %f, scientific is: %e.", dbl_num, dbl_num); + return 0; +} \ No newline at end of file From 91d30fb647eb9b048cfc7b77237f1412f352eecb Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Tue, 22 Oct 2019 18:13:58 +0200 Subject: [PATCH 08/17] H4_C5 done --- helloworld/H4_E5.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 helloworld/H4_E5.c diff --git a/helloworld/H4_E5.c b/helloworld/H4_E5.c new file mode 100644 index 0000000..a5ea916 --- /dev/null +++ b/helloworld/H4_E5.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + double dbl_num = 123.456; + printf("The numeric value of '\n' is: %d.", '\n'); + return 0; +} \ No newline at end of file From ce56711f7a9bc7a68c417704f8d3b9320b34214b Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Wed, 23 Oct 2019 08:37:52 +0200 Subject: [PATCH 09/17] H5 is done --- helloworld/H5_E1.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 helloworld/H5_E1.c diff --git a/helloworld/H5_E1.c b/helloworld/H5_E1.c new file mode 100644 index 0000000..4cdd7c5 --- /dev/null +++ b/helloworld/H5_E1.c @@ -0,0 +1,29 @@ +#include + +int main() +{ + //1. feladat + printf("%c%c%c\n",'B','y','e'); + //2. feladat + int number1 =123; + float number2 = 123.456; + printf("%d\n%f\n",number1,number2); + printf("%-8d\n%-8f\n",number1,number2); + //3. feladat + int number3 = -15; + int number4 = 150; + int number5 =1500; + printf("-15 hexadecimális formában: %x,\n 150 hexadecimális alakja: %x,\n1500 hexadecimális alakja: %x\n", number3,number4, number5); + //4. feladat + int ch; + setbuf(stdout, NULL); + printf("Please type in one character:\n"); + ch = getchar(); + printf("The character you just entered is:\n"); + putchar (ch); + + return 0; +} + +//5. feladat +// the header stdio.h is missing \ No newline at end of file From 022f5d6e58ddb8797264c6d1262156c2c45cd618 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Thu, 24 Oct 2019 13:43:18 +0200 Subject: [PATCH 10/17] H6 done --- helloworld/H6_E1.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 helloworld/H6_E1.c diff --git a/helloworld/H6_E1.c b/helloworld/H6_E1.c new file mode 100644 index 0000000..814111b --- /dev/null +++ b/helloworld/H6_E1.c @@ -0,0 +1,52 @@ +#include + +int main() +{ + //1. feladat + //Given x = 1 and y = 3, write a program to print + //out the results of these expressions: x += y, + //x += -y, x -= y, x -= -y, x *= y, and x *= -y. + int x=1; + int y=3; + printf("x += y értéke:%d\n",x += y); + x=1; + printf("x += -y értéke:%d\n",x += (-y)); + x=1; + printf("x -= y értéke:%d\n",x -= y); + x=1; + printf("x -= -y értéke:%d\n",x -= (-y)); + x=1; + printf("x *= y értéke:%d\n",x *= y); + x=1; + printf("x *= -y értéke:%d\n",x *= (-y)); + + //2. feladat + //Given x = 3 and y = 6, what is the value of z after the expression + //z = x * y == 18 is executed? + // answer is '1' + + //3. feladat + x = 1; + printf("x++ produces: %d\n", x++); + printf("Now x contains: %d\n", x); + + //4. feladat + x = 1; + printf("x = x++ produces: %d\n", x = x++); + printf("Now x contains: %d\n", x); + // x returns 1, bec x=x++ means: x++ returns 1 + + return 0; +} + +/*5. feladat +#include +main() +{ + int x, y; + x = y = 0; + printf("The comparison result is: %d\n", x = y); [x==y is the proper comparison] + return 0; +} +*/ +//setbuf(stdout, NULL); \ No newline at end of file From 1cf6e57ef877139867f935bd3d14d896c4d06623 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Thu, 24 Oct 2019 15:24:17 +0200 Subject: [PATCH 11/17] H7 done --- helloworld/H7_E1.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 helloworld/H7_E1.c diff --git a/helloworld/H7_E1.c b/helloworld/H7_E1.c new file mode 100644 index 0000000..f607585 --- /dev/null +++ b/helloworld/H7_E1.c @@ -0,0 +1,74 @@ +#include + +int main() +{ + //1.-2. feladat + //What is the difference between + //the following two pieces of code? + // for (i=0, j=1; i<8; i++, j++) + // printf("%d + %d = %d\n", i, j, i+j); + // + //for (i=0, j=1; i<8; i++, j++); + //printf("%d + %d = %d\n", i, j, i+j); + + //in the line 11 there is an "empty" loop, it does not anyting + + //2. feladat + //Write a program that contains the two pieces of + //code shown in exercise 1, and then execute the program. + //What are you going to see on the screen? + int i; + int j; + printf("2. feladat\n"); + for (i=0, j=1; i<8; i++, j++) + printf("%d + %d = %d\n", i, j, i+j); + + + for (i=0, j=1; i<8; i++, j++); + printf("%d + %d = %d\n", i, j, i+j); + //the 2. loop does'nt do anything + + + //3. feladat + //Rewrite the program in Listing 7.4. This time, + //you want the for statement to keep looping until + //the user enters the character K. + int c; + setbuf(stdout, NULL); + printf("\n3. feladat\n"); + printf("Enter a character:\n(enter K to exit)\n"); + for ( c=' '; c != 'K'; ) { + c = getc(stdin); + putchar(c); + } + printf("\nOut of the for loop. Bye!\n"); + + + //4. feladat + //Rewrite the program in Listing 7.6 by replacing + //the do-while loop with a for loop. + printf("\n4. feladat\n"); + for (i = 65; i<72; i++){ + printf("The numeric value of %c is %d.\n", i, i); + } + + //5. feladat + //Rewrite the program in Listing 7.7. + //This time, use a while loop as the outer loop + //and a do-while loop as the inner loop. + i = 1; + printf("\n5. feladat\n"); + while (i<=3) { // outer loop + printf("The start of iteration %d of the outer loop.\n", i); + j=1; + do { + printf(" Iteration %d of the inner loop.\n", j); + j++; + } while (j<=4); + printf("The end of iteration %d of the outer loop.\n", i); + i++; + } + return 0; +} + +//setbuf(stdout, NULL); \ No newline at end of file From c6c06c16e1a46222abb2041b917cded4752be975 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Fri, 25 Oct 2019 10:35:42 +0200 Subject: [PATCH 12/17] H4_E5 done. Ezt eddig nem commitoltam volna? --- helloworld/H4_E5.c | 1 - 1 file changed, 1 deletion(-) diff --git a/helloworld/H4_E5.c b/helloworld/H4_E5.c index a5ea916..e9f8d1a 100644 --- a/helloworld/H4_E5.c +++ b/helloworld/H4_E5.c @@ -2,7 +2,6 @@ int main() { - double dbl_num = 123.456; printf("The numeric value of '\n' is: %d.", '\n'); return 0; } \ No newline at end of file From 7cc5fab9f86862c3a2eccc7085c7ae8c9c437bb4 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Fri, 25 Oct 2019 10:55:58 +0200 Subject: [PATCH 13/17] =?UTF-8?q?Ez=20csak=20egy=20k=C3=ADs=C3=A9rlet=20vo?= =?UTF-8?q?lt...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helloworld/TYC_Hour_2 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/helloworld/TYC_Hour_2 b/helloworld/TYC_Hour_2 index 888db58..48363a5 100644 --- a/helloworld/TYC_Hour_2 +++ b/helloworld/TYC_Hour_2 @@ -1 +1,9 @@ -//Ezek szerint itt is lehet kódolni, közvetlenül? +#include +#include + +void main() +{ + printf ("Howdy, neighbor! This is my first C program.\n"); + exit(0); + +} \ No newline at end of file From 5c7a41ab82858cd064b3146f1221d6ae8e80d2a5 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Sat, 26 Oct 2019 20:12:26 +0200 Subject: [PATCH 14/17] code review session --- helloworld/.c | 8 ++++++++ helloworld/H2_E2.c | 5 ++--- helloworld/H2_E3.c | 8 +++----- helloworld/H3_E5.c | 15 +++++---------- helloworld/H4_E4.c | 3 +-- helloworld/H5_E1.c | 24 ++++++++++++++---------- helloworld/H7_E1.c | 35 +++++++++++++++++------------------ helloworld/ascii_bitwise.c | 7 +++++++ helloworld/xpp.c | 27 +++++++++++++++++++++++++++ 9 files changed, 84 insertions(+), 48 deletions(-) create mode 100644 helloworld/.c create mode 100644 helloworld/ascii_bitwise.c create mode 100644 helloworld/xpp.c diff --git a/helloworld/.c b/helloworld/.c new file mode 100644 index 0000000..cb9c3d9 --- /dev/null +++ b/helloworld/.c @@ -0,0 +1,8 @@ +1: /* 02L01.c: This is my first C program */ +2: #include +3: +4: main() +5: { +6: printf ("Howdy, neighbor! This is my first C program.\n"); +7: return 0; +8: } \ No newline at end of file diff --git a/helloworld/H2_E2.c b/helloworld/H2_E2.c index 68bb16f..9129de2 100644 --- a/helloworld/H2_E2.c +++ b/helloworld/H2_E2.c @@ -1,9 +1,8 @@ #include #include -void main() -{ - printf ("It's fun to write my own program in C.\n"); +void main() { + printf("It's fun to write my own program in C.\n"); exit(0); } \ No newline at end of file diff --git a/helloworld/H2_E3.c b/helloworld/H2_E3.c index fbd9ef7..256ecd2 100644 --- a/helloworld/H2_E3.c +++ b/helloworld/H2_E3.c @@ -1,9 +1,7 @@ #include #include -void main() -{ - printf ("\nHowdy, neighbor!\nThis is my first C program.\n"); - exit(0); - +void main() { + printf("\nHowdy, neighbor!\nThis is my first C program.\n"); + return 0; } \ No newline at end of file diff --git a/helloworld/H3_E5.c b/helloworld/H3_E5.c index 55cb0ae..5b97dcf 100644 --- a/helloworld/H3_E5.c +++ b/helloworld/H3_E5.c @@ -1,15 +1,10 @@ #include /* This function multiplicate two integers and returns the result */ -int integer_mult( int x, int y ) -{ - int result; - result = x * y; - return result; +int integer_mult(int x, int y) { + return x * y; } -int main() -{ - int prod; - prod = integer_mult(3, 5); - printf("3 times 5 is %d.\n", prod); + +int main() { + printf("3 times 5 is %d.\n", integer_mult(3, 5)); return 0; } \ No newline at end of file diff --git a/helloworld/H4_E4.c b/helloworld/H4_E4.c index d43b81f..8ec0ebb 100644 --- a/helloworld/H4_E4.c +++ b/helloworld/H4_E4.c @@ -1,7 +1,6 @@ #include -int main() -{ +int main() { double dbl_num = 123.456; printf("Floating is: %f, scientific is: %e.", dbl_num, dbl_num); return 0; diff --git a/helloworld/H5_E1.c b/helloworld/H5_E1.c index 4cdd7c5..9ee1565 100644 --- a/helloworld/H5_E1.c +++ b/helloworld/H5_E1.c @@ -1,25 +1,29 @@ #include -int main() -{ +int main() { //1. feladat - printf("%c%c%c\n",'B','y','e'); + printf("%c%c%c\n", 'B', 'y', 'e'); //2. feladat - int number1 =123; + int number1 = 123; float number2 = 123.456; - printf("%d\n%f\n",number1,number2); - printf("%-8d\n%-8f\n",number1,number2); + printf("%d\n%f\n", number1, number2); + printf("%-8d\n%-8f\n", number1, number2); //3. feladat int number3 = -15; int number4 = 150; - int number5 =1500; - printf("-15 hexadecimális formában: %x,\n 150 hexadecimális alakja: %x,\n1500 hexadecimális alakja: %x\n", number3,number4, number5); + int number5 = 1500; + printf( + "-15 hexadecimális formában: %x,\n 150 hexadecimális alakja: %x,\n1500 hexadecimális alakja: %x\n", + number3, + number4, + number5 + ); //4. feladat int ch; setbuf(stdout, NULL); printf("Please type in one character:\n"); - ch = getchar(); - printf("The character you just entered is:\n"); + ch = getchar(); + printf("The character you just entered is:\n"); putchar (ch); return 0; diff --git a/helloworld/H7_E1.c b/helloworld/H7_E1.c index f607585..81ebc25 100644 --- a/helloworld/H7_E1.c +++ b/helloworld/H7_E1.c @@ -1,15 +1,14 @@ #include -int main() -{ +int main() { //1.-2. feladat //What is the difference between //the following two pieces of code? // for (i=0, j=1; i<8; i++, j++) - // printf("%d + %d = %d\n", i, j, i+j); + // printf("%d + %d = %d\n", i, j, i+j); // //for (i=0, j=1; i<8; i++, j++); - //printf("%d + %d = %d\n", i, j, i+j); + //printf("%d + %d = %d\n", i, j, i+j); //in the line 11 there is an "empty" loop, it does not anyting @@ -21,11 +20,11 @@ int main() int j; printf("2. feladat\n"); for (i=0, j=1; i<8; i++, j++) - printf("%d + %d = %d\n", i, j, i+j); + printf("%d + %d = %d\n", i, j, i+j); for (i=0, j=1; i<8; i++, j++); - printf("%d + %d = %d\n", i, j, i+j); + printf("%d + %d = %d\n", i, j, i+j); //the 2. loop does'nt do anything @@ -34,23 +33,23 @@ int main() //you want the for statement to keep looping until //the user enters the character K. int c; - setbuf(stdout, NULL); + setbuf(stdout, NULL); printf("\n3. feladat\n"); printf("Enter a character:\n(enter K to exit)\n"); - for ( c=' '; c != 'K'; ) { - c = getc(stdin); + c = ' '; + while (c = getc(stdin) != 'K') { putchar(c); - } - printf("\nOut of the for loop. Bye!\n"); - + } + printf("\nOut of the for loop. Bye!\n"); + //4. feladat //Rewrite the program in Listing 7.6 by replacing //the do-while loop with a for loop. printf("\n4. feladat\n"); - for (i = 65; i<72; i++){ + for (i = 65; i < 72; i++) { printf("The numeric value of %c is %d.\n", i, i); - } + } //5. feladat //Rewrite the program in Listing 7.7. @@ -58,13 +57,13 @@ int main() //and a do-while loop as the inner loop. i = 1; printf("\n5. feladat\n"); - while (i<=3) { // outer loop + while (i <= 3) { // outer loop printf("The start of iteration %d of the outer loop.\n", i); - j=1; - do { + j = 1; + do { printf(" Iteration %d of the inner loop.\n", j); j++; - } while (j<=4); + } while (j <= 4); printf("The end of iteration %d of the outer loop.\n", i); i++; } diff --git a/helloworld/ascii_bitwise.c b/helloworld/ascii_bitwise.c new file mode 100644 index 0000000..c9db2a7 --- /dev/null +++ b/helloworld/ascii_bitwise.c @@ -0,0 +1,7 @@ +#include + +int main(){ + //printf("%c%c%c\n",'B'^0b00100000, 'y'^0b00100000, 'e'^0b00100000); + puts("%c%c%c\n", 'e'); + return 0; +} \ No newline at end of file diff --git a/helloworld/xpp.c b/helloworld/xpp.c new file mode 100644 index 0000000..111d02c --- /dev/null +++ b/helloworld/xpp.c @@ -0,0 +1,27 @@ +#include + +int main() +{ + int x = 1; + printf("x = x + 1 értéke:%d\n",x = x + 1); + printf("Now x contains: %d\n", x); + + x = 1; + printf("x++ produces: %d\n", x++); + printf("Now x contains: %d\n", x); + + + return 0; +} + +/*5. feladat +#include +main() +{ + int x, y; + x = y = 0; + printf("The comparison result is: %d\n", x = y); [x==y is the proper comparison] + return 0; +} +*/ +//setbuf(stdout, NULL); \ No newline at end of file From d99657cff0ae47fb08207c986644874c54f73f38 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Fri, 8 Nov 2019 18:21:25 +0100 Subject: [PATCH 15/17] Cleanup H4, H6, H7 --- helloworld/H4_E1.c | 3 +-- helloworld/H4_E2.c | 3 +-- helloworld/H4_E5.c | 3 +-- helloworld/H6_E1.c | 29 ++++++++++++++--------------- helloworld/H7_E1.c | 9 ++++----- 5 files changed, 21 insertions(+), 26 deletions(-) diff --git a/helloworld/H4_E1.c b/helloworld/H4_E1.c index 9c6c601..ade56cb 100644 --- a/helloworld/H4_E1.c +++ b/helloworld/H4_E1.c @@ -1,7 +1,6 @@ #include -int main() -{ +int main() { printf("The numeric value of Z is: %d, the same of z is: %d.", 'Z', 'z'); return 0; } \ No newline at end of file diff --git a/helloworld/H4_E2.c b/helloworld/H4_E2.c index c9209b5..a131fd0 100644 --- a/helloworld/H4_E2.c +++ b/helloworld/H4_E2.c @@ -1,7 +1,6 @@ #include -int main() -{ +int main() { printf("The ASCII value of 72 is character: %c, the 104 is character: %c.", 72, 104); return 0; } \ No newline at end of file diff --git a/helloworld/H4_E5.c b/helloworld/H4_E5.c index e9f8d1a..7c4986c 100644 --- a/helloworld/H4_E5.c +++ b/helloworld/H4_E5.c @@ -1,7 +1,6 @@ #include -int main() -{ +int main() { printf("The numeric value of '\n' is: %d.", '\n'); return 0; } \ No newline at end of file diff --git a/helloworld/H6_E1.c b/helloworld/H6_E1.c index 814111b..c4f8679 100644 --- a/helloworld/H6_E1.c +++ b/helloworld/H6_E1.c @@ -1,24 +1,23 @@ #include -int main() -{ +int main() { //1. feladat //Given x = 1 and y = 3, write a program to print //out the results of these expressions: x += y, //x += -y, x -= y, x -= -y, x *= y, and x *= -y. - int x=1; - int y=3; - printf("x += y értéke:%d\n",x += y); - x=1; - printf("x += -y értéke:%d\n",x += (-y)); - x=1; - printf("x -= y értéke:%d\n",x -= y); - x=1; - printf("x -= -y értéke:%d\n",x -= (-y)); - x=1; - printf("x *= y értéke:%d\n",x *= y); - x=1; - printf("x *= -y értéke:%d\n",x *= (-y)); + int x = 1; + int y = 3; + printf("x += y értéke:%d\n", x += y); + x = 1; + printf("x += -y értéke:%d\n", x += (-y)); + x = 1; + printf("x -= y értéke:%d\n", x -= y); + x = 1; + printf("x -= -y értéke:%d\n", x -= (-y)); + x = 1; + printf("x *= y értéke:%d\n", x *= y); + x = 1; + printf("x *= -y értéke:%d\n", x *= (-y)); //2. feladat //Given x = 3 and y = 6, what is the value of z after the expression diff --git a/helloworld/H7_E1.c b/helloworld/H7_E1.c index 81ebc25..f847cec 100644 --- a/helloworld/H7_E1.c +++ b/helloworld/H7_E1.c @@ -19,14 +19,13 @@ int main() { int i; int j; printf("2. feladat\n"); - for (i=0, j=1; i<8; i++, j++) - printf("%d + %d = %d\n", i, j, i+j); + for (i = 0, j = 1; i < 8; i++, j++) + printf("%d + %d = %d\n", i, j, i+j); - for (i=0, j=1; i<8; i++, j++); + for (i = 0, j = 1; i < 8; i++, j++); printf("%d + %d = %d\n", i, j, i+j); - //the 2. loop does'nt do anything - + //the 2. loop doesn't do anything //3. feladat //Rewrite the program in Listing 7.4. This time, From 3139052d966f74d794fe139b56074897f023fe22 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Fri, 8 Nov 2019 18:27:18 +0100 Subject: [PATCH 16/17] Delete TYC_Hour_2 --- helloworld/TYC_Hour_2 | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 helloworld/TYC_Hour_2 diff --git a/helloworld/TYC_Hour_2 b/helloworld/TYC_Hour_2 deleted file mode 100644 index 48363a5..0000000 --- a/helloworld/TYC_Hour_2 +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -void main() -{ - printf ("Howdy, neighbor! This is my first C program.\n"); - exit(0); - -} \ No newline at end of file From 28a54a5cee53bb40799ed0993b32ee640a2aea81 Mon Sep 17 00:00:00 2001 From: Goodwitch68 on AcerS7 <56366861+Goodwitch68@users.noreply.github.com> Date: Fri, 8 Nov 2019 18:33:11 +0100 Subject: [PATCH 17/17] H7_E1 delete useless comment --- helloworld/H7_E1.c | 1 - 1 file changed, 1 deletion(-) diff --git a/helloworld/H7_E1.c b/helloworld/H7_E1.c index f847cec..d26437a 100644 --- a/helloworld/H7_E1.c +++ b/helloworld/H7_E1.c @@ -69,4 +69,3 @@ int main() { return 0; } -//setbuf(stdout, NULL); \ No newline at end of file