From 1af26cd09452e376fe737264d534f85b4cbb15ed Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 25 Oct 2023 16:02:49 +0000 Subject: [PATCH 01/14] =?UTF-8?q?=E2=9C=85=20Auto=20update=20Working=20Pro?= =?UTF-8?q?gress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 +- docs/UnworkedProject.md | 62 +++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/docs/README.md b/docs/README.md index d0b86f2..f593d50 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,7 +12,7 @@ ![GitHub repo size](https://img.shields.io/github/repo-size/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=D8B4F8) [![GitHub contributors](https://img.shields.io/github/contributors/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=FBF0B2)](../../../graphs/contributors) -[![WorkedProject Badge](https://img.shields.io/badge/progress-225%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) +[![WorkedProject Badge](https://img.shields.io/badge/progress-229%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) [![RAR Source](https://img.shields.io/badge/rar_source-download-FF8080?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.rar/) [![TXT Github Link](https://img.shields.io/badge/txt_github_link-download-8CB369?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.txt/) diff --git a/docs/UnworkedProject.md b/docs/UnworkedProject.md index bd5e993..1de1bf1 100644 --- a/docs/UnworkedProject.md +++ b/docs/UnworkedProject.md @@ -3,36 +3,32 @@ List các file `Source.cpp` chưa làm: -1. [2. Bai112](../2.%20Bai112/Source.cpp) -2. [2. Bai117](../2.%20Bai117/Source.cpp) -3. [2. Bai122](../2.%20Bai122/Source.cpp) -4. [2. Bai127](../2.%20Bai127/Source.cpp) -5. [2. Bai132](../2.%20Bai132/Source.cpp) -6. [2. Bai137](../2.%20Bai137/Source.cpp) -7. [2. Bai142](../2.%20Bai142/Source.cpp) -8. [2. Bai147](../2.%20Bai147/Source.cpp) -9. [2. Bai152](../2.%20Bai152/Source.cpp) -10. [2. Bai157](../2.%20Bai157/Source.cpp) -11. [2. Bai158](../2.%20Bai158/Source.cpp) -12. [2. Bai162](../2.%20Bai162/Source.cpp) -13. [2. Bai163](../2.%20Bai163/Source.cpp) -14. [2. Bai167](../2.%20Bai167/Source.cpp) -15. [2. Bai168](../2.%20Bai168/Source.cpp) -16. [2. Bai172](../2.%20Bai172/Source.cpp) -17. [2. Bai177](../2.%20Bai177/Source.cpp) -18. [2. Bai180](../2.%20Bai180/Source.cpp) -19. [2. Bai182](../2.%20Bai182/Source.cpp) -20. [2. Bai187](../2.%20Bai187/Source.cpp) -21. [2. Bai192](../2.%20Bai192/Source.cpp) -22. [2. Bai197](../2.%20Bai197/Source.cpp) -23. [2. Bai202](../2.%20Bai202/Source.cpp) -24. [2. Bai204](../2.%20Bai204/Source.cpp) -25. [2. Bai205](../2.%20Bai205/Source.cpp) -26. [2. Bai207](../2.%20Bai207/Source.cpp) -27. [2. Bai212](../2.%20Bai212/Source.cpp) -28. [2. Bai217](../2.%20Bai217/Source.cpp) -29. [2. Bai222](../2.%20Bai222/Source.cpp) -30. [2. Bai225](../2.%20Bai225/Source.cpp) -31. [2. Bai227](../2.%20Bai227/Source.cpp) -32. [2. Bai232](../2.%20Bai232/Source.cpp) -33. [2. Bai237](../2.%20Bai237/Source.cpp) +1. [2. Bai132](../2.%20Bai132/Source.cpp) +2. [2. Bai137](../2.%20Bai137/Source.cpp) +3. [2. Bai142](../2.%20Bai142/Source.cpp) +4. [2. Bai147](../2.%20Bai147/Source.cpp) +5. [2. Bai152](../2.%20Bai152/Source.cpp) +6. [2. Bai157](../2.%20Bai157/Source.cpp) +7. [2. Bai158](../2.%20Bai158/Source.cpp) +8. [2. Bai162](../2.%20Bai162/Source.cpp) +9. [2. Bai163](../2.%20Bai163/Source.cpp) +10. [2. Bai167](../2.%20Bai167/Source.cpp) +11. [2. Bai168](../2.%20Bai168/Source.cpp) +12. [2. Bai172](../2.%20Bai172/Source.cpp) +13. [2. Bai177](../2.%20Bai177/Source.cpp) +14. [2. Bai180](../2.%20Bai180/Source.cpp) +15. [2. Bai182](../2.%20Bai182/Source.cpp) +16. [2. Bai187](../2.%20Bai187/Source.cpp) +17. [2. Bai192](../2.%20Bai192/Source.cpp) +18. [2. Bai197](../2.%20Bai197/Source.cpp) +19. [2. Bai202](../2.%20Bai202/Source.cpp) +20. [2. Bai204](../2.%20Bai204/Source.cpp) +21. [2. Bai205](../2.%20Bai205/Source.cpp) +22. [2. Bai207](../2.%20Bai207/Source.cpp) +23. [2. Bai212](../2.%20Bai212/Source.cpp) +24. [2. Bai217](../2.%20Bai217/Source.cpp) +25. [2. Bai222](../2.%20Bai222/Source.cpp) +26. [2. Bai225](../2.%20Bai225/Source.cpp) +27. [2. Bai227](../2.%20Bai227/Source.cpp) +28. [2. Bai232](../2.%20Bai232/Source.cpp) +29. [2. Bai237](../2.%20Bai237/Source.cpp) From 7ce8d261474b92ba348f7f38c92238ba2372d456 Mon Sep 17 00:00:00 2001 From: KevinNitroG Date: Thu, 26 Oct 2023 09:19:37 +0700 Subject: [PATCH 02/14] 158 Done --- 2. Bai158/Source.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/2. Bai158/Source.cpp b/2. Bai158/Source.cpp index 9e1927f..c8c5799 100644 --- a/2. Bai158/Source.cpp +++ b/2. Bai158/Source.cpp @@ -1,8 +1,39 @@ #include using namespace std; +struct DaThuc +{ + float a[100]; + int n; +}; +typedef struct DaThuc DATHUC; + +void Nhap(DATHUC &); +void Xuat(DATHUC); int main() { + DATHUC P; + Nhap(P); + Xuat(P); return 0; +} + +void Nhap(DaThuc &P) +{ + cout << "Nhap bac da thuc: "; + cin >> P.n; + for (int i = 0; i <= P.n; i++) + { + cout << "Nhap he so a[" << i << "]: "; + cin >> P.a[i]; + } +} + +void Xuat(DATHUC P) +{ + cout << "\nDa thuc: "; + for (int i = 0; i <= P.n; i++) + cout << P.a[i] << "x^" << i << " + "; + cout << "\b\b\b "; } \ No newline at end of file From af60db9d41da626b12944fc74684b1d4ec4277bb Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 26 Oct 2023 02:20:00 +0000 Subject: [PATCH 03/14] =?UTF-8?q?=E2=9C=85=20Auto=20update=20Working=20Pro?= =?UTF-8?q?gress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 +- docs/UnworkedProject.md | 45 ++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/docs/README.md b/docs/README.md index f593d50..1113e57 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,7 +12,7 @@ ![GitHub repo size](https://img.shields.io/github/repo-size/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=D8B4F8) [![GitHub contributors](https://img.shields.io/github/contributors/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=FBF0B2)](../../../graphs/contributors) -[![WorkedProject Badge](https://img.shields.io/badge/progress-229%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) +[![WorkedProject Badge](https://img.shields.io/badge/progress-230%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) [![RAR Source](https://img.shields.io/badge/rar_source-download-FF8080?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.rar/) [![TXT Github Link](https://img.shields.io/badge/txt_github_link-download-8CB369?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.txt/) diff --git a/docs/UnworkedProject.md b/docs/UnworkedProject.md index 1de1bf1..f7f0a99 100644 --- a/docs/UnworkedProject.md +++ b/docs/UnworkedProject.md @@ -9,26 +9,25 @@ List các file `Source.cpp` chưa làm: 4. [2. Bai147](../2.%20Bai147/Source.cpp) 5. [2. Bai152](../2.%20Bai152/Source.cpp) 6. [2. Bai157](../2.%20Bai157/Source.cpp) -7. [2. Bai158](../2.%20Bai158/Source.cpp) -8. [2. Bai162](../2.%20Bai162/Source.cpp) -9. [2. Bai163](../2.%20Bai163/Source.cpp) -10. [2. Bai167](../2.%20Bai167/Source.cpp) -11. [2. Bai168](../2.%20Bai168/Source.cpp) -12. [2. Bai172](../2.%20Bai172/Source.cpp) -13. [2. Bai177](../2.%20Bai177/Source.cpp) -14. [2. Bai180](../2.%20Bai180/Source.cpp) -15. [2. Bai182](../2.%20Bai182/Source.cpp) -16. [2. Bai187](../2.%20Bai187/Source.cpp) -17. [2. Bai192](../2.%20Bai192/Source.cpp) -18. [2. Bai197](../2.%20Bai197/Source.cpp) -19. [2. Bai202](../2.%20Bai202/Source.cpp) -20. [2. Bai204](../2.%20Bai204/Source.cpp) -21. [2. Bai205](../2.%20Bai205/Source.cpp) -22. [2. Bai207](../2.%20Bai207/Source.cpp) -23. [2. Bai212](../2.%20Bai212/Source.cpp) -24. [2. Bai217](../2.%20Bai217/Source.cpp) -25. [2. Bai222](../2.%20Bai222/Source.cpp) -26. [2. Bai225](../2.%20Bai225/Source.cpp) -27. [2. Bai227](../2.%20Bai227/Source.cpp) -28. [2. Bai232](../2.%20Bai232/Source.cpp) -29. [2. Bai237](../2.%20Bai237/Source.cpp) +7. [2. Bai162](../2.%20Bai162/Source.cpp) +8. [2. Bai163](../2.%20Bai163/Source.cpp) +9. [2. Bai167](../2.%20Bai167/Source.cpp) +10. [2. Bai168](../2.%20Bai168/Source.cpp) +11. [2. Bai172](../2.%20Bai172/Source.cpp) +12. [2. Bai177](../2.%20Bai177/Source.cpp) +13. [2. Bai180](../2.%20Bai180/Source.cpp) +14. [2. Bai182](../2.%20Bai182/Source.cpp) +15. [2. Bai187](../2.%20Bai187/Source.cpp) +16. [2. Bai192](../2.%20Bai192/Source.cpp) +17. [2. Bai197](../2.%20Bai197/Source.cpp) +18. [2. Bai202](../2.%20Bai202/Source.cpp) +19. [2. Bai204](../2.%20Bai204/Source.cpp) +20. [2. Bai205](../2.%20Bai205/Source.cpp) +21. [2. Bai207](../2.%20Bai207/Source.cpp) +22. [2. Bai212](../2.%20Bai212/Source.cpp) +23. [2. Bai217](../2.%20Bai217/Source.cpp) +24. [2. Bai222](../2.%20Bai222/Source.cpp) +25. [2. Bai225](../2.%20Bai225/Source.cpp) +26. [2. Bai227](../2.%20Bai227/Source.cpp) +27. [2. Bai232](../2.%20Bai232/Source.cpp) +28. [2. Bai237](../2.%20Bai237/Source.cpp) From 1edf4f0667335dbfaf8cab61b5295fd2f1397c2d Mon Sep 17 00:00:00 2001 From: KevinNitroG Date: Thu, 26 Oct 2023 09:28:08 +0700 Subject: [PATCH 04/14] 168 Done --- 2. Bai168/Source.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/2. Bai168/Source.cpp b/2. Bai168/Source.cpp index 9e1927f..503c3e6 100644 --- a/2. Bai168/Source.cpp +++ b/2. Bai168/Source.cpp @@ -1,8 +1,54 @@ #include using namespace std; +struct DaThuc +{ + float a[100]; + int n; +}; +typedef struct DaThuc DATHUC; + +void Nhap(DATHUC &); +void Xuat(DATHUC); +DATHUC operator+(DATHUC, DATHUC); int main() { + DATHUC P; + Nhap(P); + + DATHUC Q; + Nhap(Q); + + DATHUC R = P + Q; + Xuat(R); return 0; +} + +void Nhap(DaThuc &P) +{ + cout << "Nhap bac da thuc: "; + cin >> P.n; + for (int i = 0; i <= P.n; i++) + { + cout << "Nhap he so a[" << i << "]: "; + cin >> P.a[i]; + } +} + +void Xuat(DATHUC P) +{ + cout << "\nDa thuc: "; + for (int i = 0; i <= P.n; i++) + cout << P.a[i] << "x^" << i << " + "; + cout << "\b\b\b "; +} + +DATHUC operator+(DATHUC P, DATHUC Q) +{ + DATHUC temp; + temp.n = (P.n > Q.n) ? P.n : Q.n; + for (int i = 0; i <= temp.n; i++) + temp.a[i] = P.a[i] + Q.a[i]; + return temp; } \ No newline at end of file From 7a5d36e4c3cb2fab7934843397c0a03e7c05c815 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 26 Oct 2023 02:28:33 +0000 Subject: [PATCH 05/14] =?UTF-8?q?=E2=9C=85=20Auto=20update=20Working=20Pro?= =?UTF-8?q?gress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 +- docs/UnworkedProject.md | 37 ++++++++++++++++++------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/docs/README.md b/docs/README.md index 1113e57..2b7bacf 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,7 +12,7 @@ ![GitHub repo size](https://img.shields.io/github/repo-size/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=D8B4F8) [![GitHub contributors](https://img.shields.io/github/contributors/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=FBF0B2)](../../../graphs/contributors) -[![WorkedProject Badge](https://img.shields.io/badge/progress-230%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) +[![WorkedProject Badge](https://img.shields.io/badge/progress-231%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) [![RAR Source](https://img.shields.io/badge/rar_source-download-FF8080?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.rar/) [![TXT Github Link](https://img.shields.io/badge/txt_github_link-download-8CB369?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.txt/) diff --git a/docs/UnworkedProject.md b/docs/UnworkedProject.md index f7f0a99..a7b20bb 100644 --- a/docs/UnworkedProject.md +++ b/docs/UnworkedProject.md @@ -12,22 +12,21 @@ List các file `Source.cpp` chưa làm: 7. [2. Bai162](../2.%20Bai162/Source.cpp) 8. [2. Bai163](../2.%20Bai163/Source.cpp) 9. [2. Bai167](../2.%20Bai167/Source.cpp) -10. [2. Bai168](../2.%20Bai168/Source.cpp) -11. [2. Bai172](../2.%20Bai172/Source.cpp) -12. [2. Bai177](../2.%20Bai177/Source.cpp) -13. [2. Bai180](../2.%20Bai180/Source.cpp) -14. [2. Bai182](../2.%20Bai182/Source.cpp) -15. [2. Bai187](../2.%20Bai187/Source.cpp) -16. [2. Bai192](../2.%20Bai192/Source.cpp) -17. [2. Bai197](../2.%20Bai197/Source.cpp) -18. [2. Bai202](../2.%20Bai202/Source.cpp) -19. [2. Bai204](../2.%20Bai204/Source.cpp) -20. [2. Bai205](../2.%20Bai205/Source.cpp) -21. [2. Bai207](../2.%20Bai207/Source.cpp) -22. [2. Bai212](../2.%20Bai212/Source.cpp) -23. [2. Bai217](../2.%20Bai217/Source.cpp) -24. [2. Bai222](../2.%20Bai222/Source.cpp) -25. [2. Bai225](../2.%20Bai225/Source.cpp) -26. [2. Bai227](../2.%20Bai227/Source.cpp) -27. [2. Bai232](../2.%20Bai232/Source.cpp) -28. [2. Bai237](../2.%20Bai237/Source.cpp) +10. [2. Bai172](../2.%20Bai172/Source.cpp) +11. [2. Bai177](../2.%20Bai177/Source.cpp) +12. [2. Bai180](../2.%20Bai180/Source.cpp) +13. [2. Bai182](../2.%20Bai182/Source.cpp) +14. [2. Bai187](../2.%20Bai187/Source.cpp) +15. [2. Bai192](../2.%20Bai192/Source.cpp) +16. [2. Bai197](../2.%20Bai197/Source.cpp) +17. [2. Bai202](../2.%20Bai202/Source.cpp) +18. [2. Bai204](../2.%20Bai204/Source.cpp) +19. [2. Bai205](../2.%20Bai205/Source.cpp) +20. [2. Bai207](../2.%20Bai207/Source.cpp) +21. [2. Bai212](../2.%20Bai212/Source.cpp) +22. [2. Bai217](../2.%20Bai217/Source.cpp) +23. [2. Bai222](../2.%20Bai222/Source.cpp) +24. [2. Bai225](../2.%20Bai225/Source.cpp) +25. [2. Bai227](../2.%20Bai227/Source.cpp) +26. [2. Bai232](../2.%20Bai232/Source.cpp) +27. [2. Bai237](../2.%20Bai237/Source.cpp) From c1c0dbc8ef024b669a829341cc8f1b1da8b0d876 Mon Sep 17 00:00:00 2001 From: KevinNitroG Date: Thu, 26 Oct 2023 19:09:17 +0700 Subject: [PATCH 06/14] =?UTF-8?q?=F0=9F=93=9D=20Add=20CodeFactor=20badge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/README.md b/docs/README.md index 1113e57..ed1903f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,6 +12,8 @@ ![GitHub repo size](https://img.shields.io/github/repo-size/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=D8B4F8) [![GitHub contributors](https://img.shields.io/github/contributors/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=FBF0B2)](../../../graphs/contributors) +[![CodeFactor](https://www.codefactor.io/repository/github/nmlt-nttmk-k18/5-258-struct/badge)](https://www.codefactor.io/repository/github/nmlt-nttmk-k18/5-258-struct) + [![WorkedProject Badge](https://img.shields.io/badge/progress-230%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) [![RAR Source](https://img.shields.io/badge/rar_source-download-FF8080?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.rar/) [![TXT Github Link](https://img.shields.io/badge/txt_github_link-download-8CB369?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.txt/) From 92c9959a39127359c5cd3c68ebe6768f62c8b55e Mon Sep 17 00:00:00 2001 From: KevinNitroG Date: Thu, 26 Oct 2023 20:01:15 +0700 Subject: [PATCH 07/14] =?UTF-8?q?=F0=9F=93=9D=20Shield=20CodeFactor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 48e38b9..0841bc2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -11,8 +11,7 @@ [![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=CAEDFF)](../../../commits/main) ![GitHub repo size](https://img.shields.io/github/repo-size/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=D8B4F8) [![GitHub contributors](https://img.shields.io/github/contributors/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=FBF0B2)](../../../graphs/contributors) - -[![CodeFactor](https://www.codefactor.io/repository/github/nmlt-nttmk-k18/5-258-struct/badge)](https://www.codefactor.io/repository/github/nmlt-nttmk-k18/5-258-struct) +[![CodeFactor](https://img.shields.io/codefactor/grade/github/nmlt-nttmk-k18/5-258-struct?style=for-the-badge)](https://www.codefactor.io/repository/github/nmlt-nttmk-k18/5-258-struct) [![WorkedProject Badge](https://img.shields.io/badge/progress-231%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) From 388f34d06bfc94c312066a99b4aba1cf85d97fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=E1=BB=87=20D=C6=B0=C6=A1ng=20Th=C3=B4ng?= <23521734@gm.uit.edu.vn> Date: Thu, 26 Oct 2023 21:18:51 +0700 Subject: [PATCH 08/14] Bai225. Completed --- 2. Bai225/Source.cpp | 82 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/2. Bai225/Source.cpp b/2. Bai225/Source.cpp index 9e1927f..c3dae6e 100644 --- a/2. Bai225/Source.cpp +++ b/2. Bai225/Source.cpp @@ -1,8 +1,88 @@ #include +#include using namespace std; -int main() +struct Diem +{ + float x; + float y; +}; +typedef struct Diem DIEM; + +struct DuongThang { + float a; + float b; + float c; +}; +typedef struct DuongThang DUONGTHANG; +void Nhap(DIEM&); +void Nhap(DIEM[], int&); +void Nhap(DUONGTHANG&); +void Xuat(DIEM); +float KhoangCach(DUONGTHANG, DIEM); +DIEM GanVaKhongThuoc(DUONGTHANG, DIEM[], int); + +int main() +{ + int n; + DIEM a[100]; + DUONGTHANG d; + Nhap(a, n); + Nhap(d); + Xuat(GanVaKhongThuoc(d, a, n)); return 0; +} + +void Nhap(DIEM& P) +{ + cout << "Nhap x: "; + cin >> P.x; + cout << "Nhap y: "; + cin >> P.y; +} + +void Nhap(DIEM a[], int& n) +{ + cout << "Nhap so luong diem: "; + cin >> n; + for (int i = 0; i < n; i++) + { + cout << "Nhap diem " << i + 1 << ": " << endl; + Nhap(a[i]); + } +} + +void Nhap(DUONGTHANG& d) +{ + cout << "Nhap a: "; + cin >> d.a; + cout << "Nhap b: "; + cin >> d.b; + cout << "Nhap c: "; + cin >> d.c; +} + +void Xuat(DIEM P) +{ + cout << "x: " << P.x << endl << "y: " << P.y; +} + +float KhoangCach(DUONGTHANG d, DIEM P) +{ + float tu = abs(d.a * P.x + d.b * P.y + d.c); + float mau = sqrt(d.a * d.a + d.b * d.b); + return tu / mau; +} + +DIEM GanVaKhongThuoc(DUONGTHANG d, DIEM a[], int n) +{ + float Min = KhoangCach(d, a[0]); + for (int i = 1; i < n; i++) + if (KhoangCach(d, a[i]) < Min && KhoangCach(d, a[i]) != 0) + Min = KhoangCach(d, a[i]); + for (int i = 0; i < n; i++) + if (KhoangCach(d, a[i]) == Min) + return a[i]; } \ No newline at end of file From 27568d2e79f7bba35806426d8b3fd860c87b93d2 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 26 Oct 2023 14:19:24 +0000 Subject: [PATCH 09/14] =?UTF-8?q?=E2=9C=85=20Auto=20update=20Working=20Pro?= =?UTF-8?q?gress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 +- docs/UnworkedProject.md | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/README.md b/docs/README.md index 0841bc2..d90a92e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,7 +13,7 @@ [![GitHub contributors](https://img.shields.io/github/contributors/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=FBF0B2)](../../../graphs/contributors) [![CodeFactor](https://img.shields.io/codefactor/grade/github/nmlt-nttmk-k18/5-258-struct?style=for-the-badge)](https://www.codefactor.io/repository/github/nmlt-nttmk-k18/5-258-struct) -[![WorkedProject Badge](https://img.shields.io/badge/progress-231%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) +[![WorkedProject Badge](https://img.shields.io/badge/progress-232%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) [![RAR Source](https://img.shields.io/badge/rar_source-download-FF8080?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.rar/) [![TXT Github Link](https://img.shields.io/badge/txt_github_link-download-8CB369?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.txt/) diff --git a/docs/UnworkedProject.md b/docs/UnworkedProject.md index a7b20bb..9f309b1 100644 --- a/docs/UnworkedProject.md +++ b/docs/UnworkedProject.md @@ -26,7 +26,6 @@ List các file `Source.cpp` chưa làm: 21. [2. Bai212](../2.%20Bai212/Source.cpp) 22. [2. Bai217](../2.%20Bai217/Source.cpp) 23. [2. Bai222](../2.%20Bai222/Source.cpp) -24. [2. Bai225](../2.%20Bai225/Source.cpp) -25. [2. Bai227](../2.%20Bai227/Source.cpp) -26. [2. Bai232](../2.%20Bai232/Source.cpp) -27. [2. Bai237](../2.%20Bai237/Source.cpp) +24. [2. Bai227](../2.%20Bai227/Source.cpp) +25. [2. Bai232](../2.%20Bai232/Source.cpp) +26. [2. Bai237](../2.%20Bai237/Source.cpp) From 348f4580f333ef953776870d14e3e1e5dcb77384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=E1=BB=87=20D=C6=B0=C6=A1ng=20Th=C3=B4ng?= <23521734@gm.uit.edu.vn> Date: Thu, 26 Oct 2023 21:55:15 +0700 Subject: [PATCH 10/14] Bai205. Completed --- 2. Bai205/Source.cpp | 120 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 119 insertions(+), 1 deletion(-) diff --git a/2. Bai205/Source.cpp b/2. Bai205/Source.cpp index 9e1927f..ae61906 100644 --- a/2. Bai205/Source.cpp +++ b/2. Bai205/Source.cpp @@ -1,8 +1,126 @@ #include using namespace std; -int main() +struct Diem +{ + float x; + float y; +}; +typedef struct Diem DIEM; + +struct DuongTron { + DIEM I; + float r; +}; +typedef struct DuongTron DUONGTRON; +void Nhap(DIEM&); +void Nhap(DUONGTRON&); +void Nhap(DUONGTRON[], int&); +void Xuat(DIEM); +float KhoangCach(DIEM, DIEM); +int TuongDoi(DUONGTRON, DUONGTRON); +bool ktDoiMotCatNhau(DUONGTRON[], int); +DIEM TrungBinhTamDuongTron(DUONGTRON[], int); +void DiemThuocTatCa(DUONGTRON[], int); + +int main() +{ + int n; + DUONGTRON a[100]; + Nhap(a, n); + DiemThuocTatCa(a, n); return 0; +} + +void Nhap(DIEM& P) +{ + cout << "Nhap x: "; + cin >> P.x; + cout << "Nhap y: "; + cin >> P.y; +} + +void Nhap(DUONGTRON& c) +{ + cout << "Nhap tam: " << endl; + Nhap(c.I); + cout << "Nhap ban kinh: "; + cin >> c.r; +} + +void Nhap(DUONGTRON a[], int& n) +{ + cout << "Nhap n: "; + cin >> n; + for (int i = 0; i < n; i++) + { + cout << "Nhap a[" << i << "]:" << endl; + Nhap(a[i]); + } +} + +void Xuat(DIEM P) +{ + cout << "x = " << P.x << endl; + cout << "y = " << P.y; +} + +float KhoangCach(DIEM P, DIEM Q) +{ + return sqrt((Q.x - P.x) * (Q.x - P.x) + (Q.y - P.y) * (Q.y - P.y)); +} + +int TuongDoi(DUONGTRON c1, DUONGTRON c2) +{ + float kc = KhoangCach(c1.I, c2.I); + if (kc == 0 && c1.r == c2.r) + return 0; + if (kc > (c1.r + c2.r)) + return 1; + if (kc == (c1.r + c2.r)) + return 2; + if (kc < (c1.r + c2.r) && kc > abs(c1.r - + c2.r)) + return 3; + if (kc == abs(c1.r - c2.r)) + return 4; + return 5; +} + +bool ktDoiMotCatNhau(DUONGTRON a[], int n) +{ + int flag = 1; + for (int i = 0; i <= n - 2; i++) + for (int j = i + 1; j <= n - 1; j++) + if (TuongDoi(a[i], a[j]) != 3) + flag = 0; + return flag; +} + +DIEM TrungBinhTamDuongTron(DUONGTRON a[], int n) +{ + DIEM temp; + temp.x = 0; + temp.y = 0; + for (int i = 0; i < n; i++) + { + temp.x += a[i].I.x; + temp.y += a[i].I.y; + } + temp.x /= n; + temp.y /= n; + return temp; +} + +void DiemThuocTatCa(DUONGTRON a[], int n) +{ + if (ktDoiMotCatNhau(a, n) == 1) + { + cout << "Ton tai" << endl; + Xuat(TrungBinhTamDuongTron(a, n)); + } + else + cout << "Khong ton tai"; } \ No newline at end of file From e0a37b162b7af55d194f55534ea465ab0577f2be Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 26 Oct 2023 14:55:44 +0000 Subject: [PATCH 11/14] =?UTF-8?q?=E2=9C=85=20Auto=20update=20Working=20Pro?= =?UTF-8?q?gress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 +- docs/UnworkedProject.md | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/README.md b/docs/README.md index d90a92e..e164ed1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,7 +13,7 @@ [![GitHub contributors](https://img.shields.io/github/contributors/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=FBF0B2)](../../../graphs/contributors) [![CodeFactor](https://img.shields.io/codefactor/grade/github/nmlt-nttmk-k18/5-258-struct?style=for-the-badge)](https://www.codefactor.io/repository/github/nmlt-nttmk-k18/5-258-struct) -[![WorkedProject Badge](https://img.shields.io/badge/progress-232%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) +[![WorkedProject Badge](https://img.shields.io/badge/progress-233%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) [![RAR Source](https://img.shields.io/badge/rar_source-download-FF8080?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.rar/) [![TXT Github Link](https://img.shields.io/badge/txt_github_link-download-8CB369?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.txt/) diff --git a/docs/UnworkedProject.md b/docs/UnworkedProject.md index 9f309b1..a5d747c 100644 --- a/docs/UnworkedProject.md +++ b/docs/UnworkedProject.md @@ -21,11 +21,10 @@ List các file `Source.cpp` chưa làm: 16. [2. Bai197](../2.%20Bai197/Source.cpp) 17. [2. Bai202](../2.%20Bai202/Source.cpp) 18. [2. Bai204](../2.%20Bai204/Source.cpp) -19. [2. Bai205](../2.%20Bai205/Source.cpp) -20. [2. Bai207](../2.%20Bai207/Source.cpp) -21. [2. Bai212](../2.%20Bai212/Source.cpp) -22. [2. Bai217](../2.%20Bai217/Source.cpp) -23. [2. Bai222](../2.%20Bai222/Source.cpp) -24. [2. Bai227](../2.%20Bai227/Source.cpp) -25. [2. Bai232](../2.%20Bai232/Source.cpp) -26. [2. Bai237](../2.%20Bai237/Source.cpp) +19. [2. Bai207](../2.%20Bai207/Source.cpp) +20. [2. Bai212](../2.%20Bai212/Source.cpp) +21. [2. Bai217](../2.%20Bai217/Source.cpp) +22. [2. Bai222](../2.%20Bai222/Source.cpp) +23. [2. Bai227](../2.%20Bai227/Source.cpp) +24. [2. Bai232](../2.%20Bai232/Source.cpp) +25. [2. Bai237](../2.%20Bai237/Source.cpp) From 194cc4e8ed34396d412c52fb48df498adcc193d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tu=E1=BB=87=20D=C6=B0=C6=A1ng=20Th=C3=B4ng?= <23521734@gm.uit.edu.vn> Date: Thu, 26 Oct 2023 22:06:49 +0700 Subject: [PATCH 12/14] Bai180. Not done --- 2. Bai180/Source.cpp | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/2. Bai180/Source.cpp b/2. Bai180/Source.cpp index 9e1927f..6f13852 100644 --- a/2. Bai180/Source.cpp +++ b/2. Bai180/Source.cpp @@ -1,8 +1,48 @@ +//not done #include using namespace std; +struct Diem +{ + float x; + float y; +}; +typedef struct Diem DIEM; + +void Nhap(DIEM&); +void Nhap(DIEM[], int&); +void Xuat(DIEM); + int main() { + int n; + DIEM a[100]; + Nhap(a, n); return 0; -} \ No newline at end of file +} + +void Nhap(DIEM& P) +{ + cout << "Nhap x: "; + cin >> P.x; + cout << "Nhap y: "; + cin >> P.y; +} + +void Nhap(DIEM a[], int& n) +{ + cout << "Nhap so diem: "; + cin >> n; + for (int i = 0; i < n; i++) + { + cout << "Nhap diem " << i + 1 << ": " << endl; + Nhap(a[i]); + } +} + +void Xuat(DIEM P) +{ + cout << "x = " << P.x << endl; + cout << "y = " << P.y; +} From de7e2d9c28dae3b97584357280c1b10bf60df389 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 26 Oct 2023 15:07:17 +0000 Subject: [PATCH 13/14] =?UTF-8?q?=E2=9C=85=20Auto=20update=20Working=20Pro?= =?UTF-8?q?gress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 2 +- docs/UnworkedProject.md | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/docs/README.md b/docs/README.md index e164ed1..9f880a4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -13,7 +13,7 @@ [![GitHub contributors](https://img.shields.io/github/contributors/NMLT-NTTMK-K18/5-258-struct?style=for-the-badge&color=FBF0B2)](../../../graphs/contributors) [![CodeFactor](https://img.shields.io/codefactor/grade/github/nmlt-nttmk-k18/5-258-struct?style=for-the-badge)](https://www.codefactor.io/repository/github/nmlt-nttmk-k18/5-258-struct) -[![WorkedProject Badge](https://img.shields.io/badge/progress-233%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) +[![WorkedProject Badge](https://img.shields.io/badge/progress-234%20%2F%20258-82A0D8?style=for-the-badge)](./UnworkedProject.md) [![RAR Source](https://img.shields.io/badge/rar_source-download-FF8080?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.rar/) [![TXT Github Link](https://img.shields.io/badge/txt_github_link-download-8CB369?style=for-the-badge)](../../../releases/download/RAR/23520161_23520730_23520623_23521049_23521734_BT05.txt/) diff --git a/docs/UnworkedProject.md b/docs/UnworkedProject.md index a5d747c..d748aa8 100644 --- a/docs/UnworkedProject.md +++ b/docs/UnworkedProject.md @@ -14,17 +14,16 @@ List các file `Source.cpp` chưa làm: 9. [2. Bai167](../2.%20Bai167/Source.cpp) 10. [2. Bai172](../2.%20Bai172/Source.cpp) 11. [2. Bai177](../2.%20Bai177/Source.cpp) -12. [2. Bai180](../2.%20Bai180/Source.cpp) -13. [2. Bai182](../2.%20Bai182/Source.cpp) -14. [2. Bai187](../2.%20Bai187/Source.cpp) -15. [2. Bai192](../2.%20Bai192/Source.cpp) -16. [2. Bai197](../2.%20Bai197/Source.cpp) -17. [2. Bai202](../2.%20Bai202/Source.cpp) -18. [2. Bai204](../2.%20Bai204/Source.cpp) -19. [2. Bai207](../2.%20Bai207/Source.cpp) -20. [2. Bai212](../2.%20Bai212/Source.cpp) -21. [2. Bai217](../2.%20Bai217/Source.cpp) -22. [2. Bai222](../2.%20Bai222/Source.cpp) -23. [2. Bai227](../2.%20Bai227/Source.cpp) -24. [2. Bai232](../2.%20Bai232/Source.cpp) -25. [2. Bai237](../2.%20Bai237/Source.cpp) +12. [2. Bai182](../2.%20Bai182/Source.cpp) +13. [2. Bai187](../2.%20Bai187/Source.cpp) +14. [2. Bai192](../2.%20Bai192/Source.cpp) +15. [2. Bai197](../2.%20Bai197/Source.cpp) +16. [2. Bai202](../2.%20Bai202/Source.cpp) +17. [2. Bai204](../2.%20Bai204/Source.cpp) +18. [2. Bai207](../2.%20Bai207/Source.cpp) +19. [2. Bai212](../2.%20Bai212/Source.cpp) +20. [2. Bai217](../2.%20Bai217/Source.cpp) +21. [2. Bai222](../2.%20Bai222/Source.cpp) +22. [2. Bai227](../2.%20Bai227/Source.cpp) +23. [2. Bai232](../2.%20Bai232/Source.cpp) +24. [2. Bai237](../2.%20Bai237/Source.cpp) From 1d2177fad286961fb6987b2eeddabd1cd01371d3 Mon Sep 17 00:00:00 2001 From: Kevin Nitro Date: Fri, 27 Oct 2023 02:51:05 +0700 Subject: [PATCH 14/14] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3d066fc --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 NMLT - NTTMK - K18 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.