diff --git a/C_tutorial/C_Advance/Makefile b/C_tutorial/C_Advance/Makefile new file mode 100644 index 0000000..bb73e94 --- /dev/null +++ b/C_tutorial/C_Advance/Makefile @@ -0,0 +1,5 @@ +defaults: + gcc -o test.o struct_operation.c + +clean: + rm -f *.o diff --git a/C_tutorial/C_Advance/dynamicArraystruct.c b/C_tutorial/C_Advance/dynamicArraystruct.c new file mode 100644 index 0000000..63f3243 --- /dev/null +++ b/C_tutorial/C_Advance/dynamicArraystruct.c @@ -0,0 +1,30 @@ +#include "stdio.h" +#include "stdlib.h" + +typedef struct point { + int x; + int y; +}Point; + +int main(){ + Point pointArray[5]; + printf("Enter the value first point x\n"); + scanf("%d",&pointArray[0].x); + printf("Enter the value first point y\n"); + scanf("%d",&pointArray[0].y); + + for(int i=0;i<5;i++) + { + /*Enter code and innovate*/ + printf("Enter the value point x string #%d \n",i+1); + scanf("%d",&pointArray[i].x); + printf("Enter the value point y string #%d \n",i+1); + scanf("%d",&pointArray[i].y); + } + for (int i=0;i<5;i++){ + printf("Point #%d = (%d,%d)\n",i+1,pointArray[i].x,pointArray[i].y); + } + return 0; +} + + diff --git a/C_tutorial/C_Advance/exercise1.c b/C_tutorial/C_Advance/exercise1.c new file mode 100644 index 0000000..7e35278 --- /dev/null +++ b/C_tutorial/C_Advance/exercise1.c @@ -0,0 +1,38 @@ +#include "stdio.h" +#include "stdlib.h" + + + +/*Exercise 2 : + Write the function : + Function 1:-get the function variable and prints it information + Function 2:-responsible for getting input from user and return it*/ +#include "stdio.h" +#include "stdlib.h" + +typedef struct Point +{ + /* data for struct point x,y */ + int x; + int y; +}Point; + +void printPoint(Point pt) { + printf("The value of x: %d\n",pt.x); + printf("The value of y: %d\n",pt.y); +} +Point pointview(){ + Point pt; + printf("Enter the value of x:\n"); + scanf("%d",&pt.x); + printf("Enter the value of y:\n"); + scanf("%d",&pt.y); + return pt; +} +int main(){ + Point pt1; + pt1 = pointview(); + printPoint(pt1); + + return 0; +} \ No newline at end of file diff --git a/C_tutorial/C_Advance/pointer.c b/C_tutorial/C_Advance/pointer.c new file mode 100644 index 0000000..2d63584 --- /dev/null +++ b/C_tutorial/C_Advance/pointer.c @@ -0,0 +1,29 @@ +#include "stdio.h" +#include "stdlib.h" + +int main(){ + int num1 = 50; + int num2 = 100; + int *ptrA, *ptrB; + printf("The value of number:%d\t%d\n",num1,num2); + + /*tro den gia tri num1 num2 : pointer khai bao*/ + ptrA = &num1; + ptrB = &num2; + printf("The value of num1,num2:%d\t%d\n",num1,num2); + + + *ptrA = *ptrA+1 ; + *ptrB = *ptrB+3; + printf("The value new the number1 and number2 %d\t%d\n",num1,num2); + + ptrA = ptrB; + ptrB = ptrA; + printf("num1 %d \t, num2 %d\n",num1,num2); + printf("*ptrA = %d, *ptrB = %d \n",*ptrA,*ptrB); + + num1 = *ptrB; + num2 = num1 - 3 ; + printf("num1 = %d,num2 = %d \n",num1,num2); + return 0; +} diff --git a/C_tutorial/C_Advance/pointer_advance.c b/C_tutorial/C_Advance/pointer_advance.c new file mode 100644 index 0000000..f2a5530 --- /dev/null +++ b/C_tutorial/C_Advance/pointer_advance.c @@ -0,0 +1,22 @@ +#include "stdio.h" +#include "stdlib.h" + +void findMaxMin(int num1, int num2,int *ptrA, int *ptrB){ + if (num1>num2) { + *ptrA = num1; + *ptrB = num2; + } + else { + *ptrA = num2; + *ptrB = num1; + } +} +int main(){ + int a = 10, b = 20; + int max,min; + findMaxMin(a,b,&max,&min); + printf("The value of max %d \n",max); + printf("The value of min %d \n",min); + + return 0; +} \ No newline at end of file diff --git a/C_tutorial/C_Advance/pointer_pratice.c b/C_tutorial/C_Advance/pointer_pratice.c new file mode 100644 index 0000000..661c83f --- /dev/null +++ b/C_tutorial/C_Advance/pointer_pratice.c @@ -0,0 +1,27 @@ +// #include "stdio.h" +// #include "stdlib.h" + + +// int main(){ +// int a = 5; +// int *p; +// p = &a; +// printf("%p \n",&a); +// printf("%p \n",p); +// printf("%d \n",a); +// printf("%d \n",*p); +// return 0; +// } + +#include "stdio.h" +#include "stdlib.h" + +int main(){ + int grade1 = 80, grade2 = 100; + printf("value of grade1 : %d \n",grade1); + printf("value of grade2: %d \n",grade2); + + printf("Address of the grade1 %p\n",&grade1); + printf("Address of the grade2 %p\n",&grade2); + return 0; +} \ No newline at end of file diff --git a/C_tutorial/C_Advance/struct.c b/C_tutorial/C_Advance/struct.c new file mode 100644 index 0000000..73c4145 --- /dev/null +++ b/C_tutorial/C_Advance/struct.c @@ -0,0 +1,39 @@ +#include "stdio.h" +#include "stdlib.h" + +// struct point { +// int x; +// int y; +// }; + +// struct date +// { +// /*struct in day for using cusomized data */ +// int day; +// int months; +// int year; +// }; + +/*typedef example */ +typedef struct date{ + int day; + int months; + int year; +}Date; +int main() +{ + struct date graduteDate; + printf("Enter day:"); + scanf("%d",&graduteDate.day); + + printf("Enter months:"); + scanf("%d",&graduteDate.months); + + printf("Enter year:"); + scanf("%d",&graduteDate.year); + printf("The my gradute day is (%d,%d,%d) \n",graduteDate.day,graduteDate.months,graduteDate.year); + + + return 0; +} + diff --git a/C_tutorial/C_Advance/struct_members.c b/C_tutorial/C_Advance/struct_members.c new file mode 100644 index 0000000..2daaba3 --- /dev/null +++ b/C_tutorial/C_Advance/struct_members.c @@ -0,0 +1,26 @@ +#include "stdio.h" +#include "stdlib.h" +#include "string.h" + +typedef struct employee{ + char name[10]; + float age; + int id; +}Employee; + +int main(){ + Employee emp1; + Employee emp2 = {"Jake",25.4,123}; + + emp1 = emp2; + printf("Employee 1 is name %s\n",emp1.name); + printf("Employee 2 is name %s\n",emp2.name); + + strcpy(emp1.name,"Join"); + emp1.id = 456; + + printf("Id of members %d\n",emp1.id); + printf("The name of members 1 %s\n",emp1.name); +return 0; + +} diff --git a/C_tutorial/C_Advance/struct_operation.c b/C_tutorial/C_Advance/struct_operation.c new file mode 100644 index 0000000..1e1c2c1 --- /dev/null +++ b/C_tutorial/C_Advance/struct_operation.c @@ -0,0 +1,81 @@ +#include "stdio.h" +#include "stdlib.h" +#include "string.h" + +typedef struct point +{ + int x; + int y; +}Point; + +typedef struct employee +{ + char name[10]; + float age; + int id; +}Employee; + +int equalPoints(Point p1, Point p2) // "Operation ==" +{ + if((p1.x == p2.x)&&(p1.y==p2.y)){ + return 1; + } + else { + return 0; + } +} +int notEqualPoints(Point p1, Point p2) // "Operation !=" +{ + if((p1.x != p2.x)||(p1.y!=p2.y)){ + return 1; + } + else { + return 0; + } +} + +int equalAge(Employee e1,Employee e2) +{ + if(e1.age == e2.age){ + return 0; + } + else if (e1.age < e2.age) { + return -1; + } + else //e2.age > e1.age + return 1; +} + +int equalName(Employee e1,Employee e2) +{ + if(e1.name == e2.name){ + return 0; + } + else if (e1.name < e2.name) { + return -1; + } + else //e2.age > e1.age + return 1; +} +int equalId(Employee e1,Employee e2) +{ + if(e1.id == e2.id){ + return 0; + } + else if (e1.id < e2.id) { + return -1; + } + else //e2.age > e1.age + return 1; +} + +int main() +{ + Point point1 = {2,4}; + Point point2 = {3,5}; + if (equalPoints(point1,point2) !=0) { + // Code related to the fact that the points are equal + printf("The struct is not equal\n"); + } +return 0; +} diff --git a/C_tutorial/C_Advance/struct_test.c b/C_tutorial/C_Advance/struct_test.c new file mode 100644 index 0000000..ec39b0d --- /dev/null +++ b/C_tutorial/C_Advance/struct_test.c @@ -0,0 +1,31 @@ +// #include "stdio.h" +// #include "stdlib.h" + +// typedef struct point +// { +// int x; +// int y; +// }Point; + +// int main() +// { +// Point p1; +// Point p2 = {5,7}; +// Point p3 = {.x = 3, .y = 5}; +// Point p4 = {.y = 10, .x =5}; +// Point p5 = {.x=10}; + +// return 0; +// } + + /*Write the function + - Function 1: get the point variable and print this information + - Function 2: responsible for getting a point input from the user and the return it*/ +#include "stdio.h" +#include "stdlib.h" + +int main() +{ + + return 0; +} \ No newline at end of file diff --git a/C_tutorial/C_Advance/typedef.c b/C_tutorial/C_Advance/typedef.c new file mode 100644 index 0000000..773f146 --- /dev/null +++ b/C_tutorial/C_Advance/typedef.c @@ -0,0 +1,40 @@ +#include "stdio.h" +#include "stdlib.h" + + + +typedef struct date +{ + int day;\ + int months; + int year; +}Date; + +void printDate(Date dt) +{ + printf("Year = %d,Months = %d, Day =%d \n",dt.year,dt.months,dt.day); +} +Date inputDate(){ + Date dt; + printf("Enter day:"); + scanf("%d",&dt.day); + + printf("Enter months"); + scanf("%d",&dt.months); + + printf("Enter year"); + scanf("%d",&dt.year); + return dt; +} +int main() +{ + Date graduteDate,todayDate; + graduteDate = inputDate(); + + todayDate = inputDate(); + printDate(graduteDate); + printDate(todayDate); + + + return 0; +} diff --git a/C_tutorial/C_Algorithm/pratice1.c b/C_tutorial/C_Algorithm/pratice1.c new file mode 100644 index 0000000..e6bff65 --- /dev/null +++ b/C_tutorial/C_Algorithm/pratice1.c @@ -0,0 +1,11 @@ +#include "stdio.h" + +int test(int x, int y) { + return x==y? (x+y)*3:(x+y); +}; +// int test(int x,int y); +int main(){ + printf("%d\n",test(1,2)); + printf("%d\n",test(2,2)); + return 0; +} \ No newline at end of file diff --git a/C_tutorial/C_Algorithm/pratice2.c b/C_tutorial/C_Algorithm/pratice2.c new file mode 100644 index 0000000..418975d --- /dev/null +++ b/C_tutorial/C_Algorithm/pratice2.c @@ -0,0 +1,12 @@ +#include "stdio.h" + +int test (int n){ + const int x = 51; + return (n>x)?(n-x)*3:(x-n); +} +int main(){ + printf("%d\n",test(51)); + printf("%d\n",test(52)); + printf("%d\n",test(49)); + return 0; +} \ No newline at end of file diff --git a/C_tutorial/C_Algorithm/pratice3.c b/C_tutorial/C_Algorithm/pratice3.c new file mode 100644 index 0000000..c999984 --- /dev/null +++ b/C_tutorial/C_Algorithm/pratice3.c @@ -0,0 +1,11 @@ +#include "stdio.h" + +int test(int x, int y){ + return (x==30|| y==30|| (x+y)==30); +} +int main(){ + printf("%d\n",test(20,21)); + printf("%d\n",test(25,5)); + printf("%d\n",test(30,1)); + return 0; +} \ No newline at end of file diff --git a/C_tutorial/C_Algorithm/pratice4.c b/C_tutorial/C_Algorithm/pratice4.c new file mode 100644 index 0000000..6115c3f --- /dev/null +++ b/C_tutorial/C_Algorithm/pratice4.c @@ -0,0 +1,12 @@ +#include "stdio.h" +#include "stdlib.h" + +int test (int x) { + return (abs(100-x)<=10)||(abs(200-x)<=20); +} +int main() { + printf("%d\n",test(103)); + printf("%d\n",test(90)); + printf("%d\n",test(89)); + return 0; +} \ No newline at end of file diff --git a/C_tutorial/C_Algorithm/pratice5.c b/C_tutorial/C_Algorithm/pratice5.c new file mode 100644 index 0000000..1044150 --- /dev/null +++ b/C_tutorial/C_Algorithm/pratice5.c @@ -0,0 +1,13 @@ +#include "stdio.h" +#include "stdlib.h" + +int test(int n){ + return (n%3==0||n%7==0); +} +int main(){ + printf("%d\n",test(45)); + printf("%d\n",test(14)); + printf("%d\n",test(3)); + printf("%d\n",test(16)); + return 0; +} \ No newline at end of file diff --git a/C_tutorial/C_Algorithm/pratice6.c b/C_tutorial/C_Algorithm/pratice6.c new file mode 100644 index 0000000..d209925 --- /dev/null +++ b/C_tutorial/C_Algorithm/pratice6.c @@ -0,0 +1,13 @@ +#include "stdio.h" +#include "stdlib.h" +#define LOWER 0 +#define UPPER 100 +int test(int x, int y) { + return (x< LOWER && y> UPPER)||(ynum2){ + if(num1 > num3){ + return num1; + } + else + { + return num3; + } + + } + else if( num2>num3){ + return num2; + } + else return num3; +} +int main(){ + int max; + max = Maxvalue(); + printf("The value of string function is max value is : %d \n",max); + return 0; +} diff --git a/C_tutorial/C_basic/pratice_swap.c b/C_tutorial/C_basic/pratice_swap.c new file mode 100644 index 0000000..c39e3bf --- /dev/null +++ b/C_tutorial/C_basic/pratice_swap.c @@ -0,0 +1,21 @@ +#include "stdio.h" +#include "stdlib.h" + +int main() +{ int a,b; + printf("Enter the value a: \n"); + scanf("%d",&a); + + printf("Enter the value b: \n"); + scanf("%d",&b); + + // swap the value of pratice + int temp; + temp =a ; + a=b; + b=temp; + + printf("The value after a: %d\n",a); + printf("The value after b: %d\n",b); + return 0; +} diff --git a/C_tutorial/C_basic/pratice_time.c b/C_tutorial/C_basic/pratice_time.c new file mode 100644 index 0000000..7b881bb --- /dev/null +++ b/C_tutorial/C_basic/pratice_time.c @@ -0,0 +1,16 @@ +#include "stdio.h" +#include "stdlib.h" + +int main(){ + float time_hours,time , distance, speed; + float temp; + printf("Enter the speed for the vehicle \n"); + scanf("%f",&speed); + printf("Enter the distance from A to B\n"); + scanf("%f",&distance); + time_hours = (float)(distance/speed); + time = time_hours*60; + printf("The time is vehicle : %f\n",time); + +return 0; +} diff --git a/Command line Ubuntu.pdf b/Command line Ubuntu.pdf deleted file mode 100644 index b0dd52c..0000000 Binary files a/Command line Ubuntu.pdf and /dev/null differ diff --git a/Configure Raspberry.docx b/Configure Raspberry.docx deleted file mode 100644 index 1aed75a..0000000 Binary files a/Configure Raspberry.docx and /dev/null differ diff --git a/LPIC-1 Study Guide_5th Edition.pdf b/LPIC-1 Study Guide_5th Edition.pdf deleted file mode 100644 index be6b6b8..0000000 Binary files a/LPIC-1 Study Guide_5th Edition.pdf and /dev/null differ diff --git a/LPIC-2_LPIC_Study_Guide(2016)_2nd edition.pdf b/LPIC-2_LPIC_Study_Guide(2016)_2nd edition.pdf deleted file mode 100644 index 5ee24dd..0000000 Binary files a/LPIC-2_LPIC_Study_Guide(2016)_2nd edition.pdf and /dev/null differ diff --git a/keyboard-shortcuts-windows b/keyboard-shortcuts-windows deleted file mode 100644 index ade3680..0000000 Binary files a/keyboard-shortcuts-windows and /dev/null differ diff --git a/linux-command-line-and-shell-scripting-bible-by-richard-blum-christine-bresnahan.pdf b/linux-command-line-and-shell-scripting-bible-by-richard-blum-christine-bresnahan.pdf deleted file mode 100644 index e2e83f4..0000000 Binary files a/linux-command-line-and-shell-scripting-bible-by-richard-blum-christine-bresnahan.pdf and /dev/null differ