From f96cc9fe86be59f474850ab667f68782e2054d42 Mon Sep 17 00:00:00 2001 From: Mehrdad Shirvani Date: Fri, 14 Nov 2025 20:08:33 +0330 Subject: [PATCH] refactor --- .../01-problem-solving/1-Workshop.md | 63 ------- .../01-problem-solving/2-Assignment.md | 43 ++--- .../01-problem-solving/5-TASlides.md | 6 + .../02-basics-and-data-types/1-Workshop.md | 43 ++--- .../02-basics-and-data-types/2-Assignment.md | 54 ++---- .../02-basics-and-data-types/3-Q&A.md | 9 - .../4-ProfessorSlides.md | 13 ++ .../02-basics-and-data-types/5-TASlides.md | 11 ++ .../03-conditions-loops/0-Overview.md | 157 ++++++++++++++++++ .../03-conditions-loops/4-ProfessorSlides.md | 6 + .../03-conditions-loops/5-TASlides.md | 6 + 11 files changed, 248 insertions(+), 163 deletions(-) delete mode 100644 src/content/01-topics/01-problem-solving/1-Workshop.md create mode 100644 src/content/01-topics/01-problem-solving/5-TASlides.md create mode 100644 src/content/01-topics/02-basics-and-data-types/4-ProfessorSlides.md create mode 100644 src/content/01-topics/02-basics-and-data-types/5-TASlides.md create mode 100644 src/content/01-topics/03-conditions-loops/0-Overview.md create mode 100644 src/content/01-topics/03-conditions-loops/4-ProfessorSlides.md create mode 100644 src/content/01-topics/03-conditions-loops/5-TASlides.md diff --git a/src/content/01-topics/01-problem-solving/1-Workshop.md b/src/content/01-topics/01-problem-solving/1-Workshop.md deleted file mode 100644 index a18fbd1..0000000 --- a/src/content/01-topics/01-problem-solving/1-Workshop.md +++ /dev/null @@ -1,63 +0,0 @@ - -> [!info] Brief description -> This page lists the **workshop questions** for this topic and provides **downloadable official solutions**. -> These questions are meant to help you apply the concepts learned in class through hands-on coding exercises. - ---- - -> [!tip] How to use this page -> - Start by attempting each question on your own. -> - Use the official solutions only to review and learn better approaches. -> - If something doesn’t make sense, **ask a TA** during or after the session. -> - Check the [Q&A page](../resources/qa.md) for common questions and clarifications. - ---- - -## 📦 Download All Solutions - -- **All official solutions (zip):** [Download all official solutions](./workshops/01-basics-data-types/official-solutions.zip) - ---- - -## 🧾 Official Questions & Solutions - -| Question # | Title / Short Description | Question (Download) | Official Solution (Download) | -| ---------- | ------------------------------------------------------------- | ---------------------------------------------- | ---------------------------------------------------- | -| Q1 | Simple I/O and variables — read two numbers and print the sum | [Download PDF](./workshops/01-q1-question.pdf) | [01-q1-solution.cpp](./workshops/01-q1-solution.cpp) | -| Q2 | Type conversion — integer division vs floating point | [Download PDF](./workshops/01-q2-question.pdf) | [01-q2-solution.cpp](./workshops/01-q2-solution.cpp) | -| Q3 | Using `` — compute and format results | [Download PDF](./workshops/01-q3-question.pdf) | [01-q3-solution.cpp](./workshops/01-q3-solution.cpp) | -| Q4 | Edge cases & input validation | [Download PDF](./workshops/01-q4-question.pdf) | [01-q4-solution.cpp](./workshops/01-q4-solution.cpp) | - -> [!note] Not available yet? -> Some solutions will be uploaded after the workshop or assignment deadline. Check back later or ask your TA. - ---- - -## ❓ Q&A and Support - -> [!question] Got stuck or confused? -> If something in a question or solution is unclear: -> - Revisit the lecture notes and workshop slides. -> - Check the [Q&A page](../resources/qa.md) for clarifications. -> - Ask your TA — that’s what we’re here for. - -- [Topic Q&A](../resources/qa.md) -- [Workshop Slides](./workshops/01-basics-data-types/slides.pdf) - ---- - -## 🙏 Acknowledgements - -> [!success] Special thanks -> These materials were created collaboratively to support your learning. -> - You are encouraged to use and adapt the solutions **for learning**, not copying. -> - If you find an error or have a better solution, you can suggest an improvement. -> - TA and instructor feedback will be added over time. - ---- - -## ⚖️ Licensing & Usage - -> [!important] Usage note -> Official workshop solutions are for **educational use only**. Please do not repost them publicly or use them in ways that violate course policy. - diff --git a/src/content/01-topics/01-problem-solving/2-Assignment.md b/src/content/01-topics/01-problem-solving/2-Assignment.md index 2343ef4..d29f442 100644 --- a/src/content/01-topics/01-problem-solving/2-Assignment.md +++ b/src/content/01-topics/01-problem-solving/2-Assignment.md @@ -9,24 +9,29 @@ > - Start by attempting each question on your own. > - Use the official solutions only to review and learn better approaches. > - If something doesn’t make sense, **ask a TA**. -> - Check the [Q&A page](../resources/qa.md) for common questions and clarifications. --- -## 📦 Download All Solutions +## 📦 Download All Questions and Solutions -- **All official solutions (zip):** [Download all official solutions](./workshops/01-basics-data-types/official-solutions.zip) +- **All questions (zip):** [Download all questions](https://drive.google.com/file/d/1SaM7dICduui9NjqiqHTU-5L_AftlvoHE/view?usp=drive_link) +- **All official solutions (zip):** [Download all official solutions](https://drive.google.com/file/d/1V3GwUGKBhvXT5Ab1fDy7Ek27x-1Q4Nny/view?usp=drive_link) --- - ## 🧾 Official Questions & Solutions -| Question # | Title / Short Description | Question (Download) | Official Solution (Download) | -| ---------- | ------------------------------------------------------------- | ---------------------------------------------- | ---------------------------------------------------- | -| Q1 | Simple I/O and variables — read two numbers and print the sum | [Download PDF](./workshops/01-q1-question.pdf) | [01-q1-solution.cpp](./workshops/01-q1-solution.cpp) | -| Q2 | Type conversion — integer division vs floating point | [Download PDF](./workshops/01-q2-question.pdf) | [01-q2-solution.cpp](./workshops/01-q2-solution.cpp) | -| Q3 | Using `` — compute and format results | [Download PDF](./workshops/01-q3-question.pdf) | [01-q3-solution.cpp](./workshops/01-q3-solution.cpp) | -| Q4 | Edge cases & input validation | [Download PDF](./workshops/01-q4-question.pdf) | [01-q4-solution.cpp](./workshops/01-q4-solution.cpp) | +| Question # | Question (Download) | Official Solution (Download) | Additional Notes | +| ---------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------- | +| 01 | [Download PDF](https://drive.google.com/file/d/1mQd1oFr605IYz8SFA0u07_tt8w5ibEIp/view?usp=sharing) | [Download Solution (zip)](https://drive.google.com/file/d/1suqDVN3OtZDS4EnfJInVoM1tal6QWUit/view?usp=drive_link) | | +| 02 | [Download PDF](https://drive.google.com/file/d/1mv7Mp3gxYSK1r-OH5h88ueJMSUCSC-Gc/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1UUlwNpQvdQU7S_h_azYSAudxsZKi6NtW/view?usp=drive_link) | | +| 03 | [Download PDF](https://drive.google.com/file/d/1FT1YFfGDekytEDnRd2wNThTNRIJ0Gtvx/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1vtC4GwdEd2Q3YSos9FWzJeYEJy_4gwuu/view?usp=drive_link) | | +| 04 | [Download PDF](https://drive.google.com/file/d/1ql1-JOaNArnH4aHjOvZkmWqYyDFcAKsV/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/17gfm6Ocl1RrA57FLJC4DS2-hn_gvVfFZ/view?usp=drive_link) | | +| 05 | [Download PDF](https://drive.google.com/file/d/1ev7SrFO4kdSkPn7ZX8z148QptLDJVpmG/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1OuI3u81ll6-GKARoVYUEjabFaHTINyKm/view?usp=drive_link) | | +| 06 | [Download PDF](https://drive.google.com/file/d/1cSJwqGXNXzu8foMDh9585VM6MzkQ1TKH/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1alVdHcCxrTcCIH0wZbS6CDCCmDclNaRH/view?usp=drive_link) | | +| 07 | [Download PDF](https://drive.google.com/file/d/1klayxpRC-EIC_E7S_-SnOojA3lUmuNrZ/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/11pjUFIcS83qcy7Ac5l8DHL-EEgkVO5NE/view?usp=drive_link) | | +| 08 | [Download PDF](https://drive.google.com/file/d/18yKwoek6fmrSaUZWF79rrIn5BGS0GUIK/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1OuPGpJgkfB8BHoDlMaTDnlRn9NhyLDdA/view?usp=drive_link) | | +| 09 | [Download PDF](https://drive.google.com/file/d/1i9XugaK_iqJlgaWemrrZbYxNlGmXsm9d/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1Ppni5K6EQZF2mqVR_u6dq7NyXS-eHZ-1/view?usp=drive_link) | | +| 10 | [Download PDF](https://drive.google.com/file/d/1ihsQfgfZp7wWRt33lm3-ZPAnkQ0I5bv4/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/110ieA_9qNIyvweunLKChcQHcraSeoWI6/view?usp=drive_link) | | > [!note] Not available yet? > Some solutions will be uploaded after the workshop or assignment deadline. Check back later or ask your TA. @@ -38,25 +43,11 @@ > [!question] Got stuck or confused? > If something in a question or solution is unclear: > - Revisit the lecture notes and workshop slides. -> - Check the [Q&A page](../resources/qa.md) for clarifications. > - Ask your TA — that’s what we’re here for. -- [Topic Q&A](../resources/qa.md) -- [Workshop Slides](./workshops/01-basics-data-types/slides.pdf) -- [Professor Slides](../lectures/01-data-types/professor-slides.pdf) - +- [Topic Q&A](01-topics/01-problem-solving/3-Q&A.md) +- [TA Slides](01-topics/01-problem-solving/5-TASlides.md) --- - -## 🙏 Acknowledgements - -> [!success] Special thanks -> These materials were created collaboratively to support your learning. -> - You are encouraged to use and adapt the solutions **for learning**, not copying. -> - If you find an error or have a better solution, you can suggest an improvement. -> - TA and instructor feedback will be added over time. - ---- - ## ⚖️ Licensing & Usage > [!important] Usage note diff --git a/src/content/01-topics/01-problem-solving/5-TASlides.md b/src/content/01-topics/01-problem-solving/5-TASlides.md new file mode 100644 index 0000000..01617db --- /dev/null +++ b/src/content/01-topics/01-problem-solving/5-TASlides.md @@ -0,0 +1,6 @@ +## 🔗 Download +- [Download PDF](https://drive.usercontent.google.com/u/0/uc?id=1_e2c5by8f2r-sWSpjnioXWm16mUZFTtp&export=download) +## View PDF Online + + + diff --git a/src/content/01-topics/02-basics-and-data-types/1-Workshop.md b/src/content/01-topics/02-basics-and-data-types/1-Workshop.md index c828be1..25c5685 100644 --- a/src/content/01-topics/02-basics-and-data-types/1-Workshop.md +++ b/src/content/01-topics/02-basics-and-data-types/1-Workshop.md @@ -8,57 +8,42 @@ > [!tip] How to use this page > - Start by attempting each question on your own. > - Use the official solutions only to review and learn better approaches. -> - If something doesn’t make sense, **ask a TA** during or after the session. -> - Check the [Q&A page](../resources/qa.md) for common questions and clarifications. +> - If something doesn’t make sense, **ask a TA**. --- -## 📦 Download All Solutions +## 📦 Download All Questions and Solutions -- **All official solutions (zip):** [Download all official solutions](./workshops/01-basics-data-types/official-solutions.zip) +- **All questions (zip):** [Download all questions](https://drive.google.com/file/d/1SaM7dICduui9NjqiqHTU-5L_AftlvoHE/view?usp=drive_link) +- **All official solutions (zip):** [Download all official solutions](https://drive.google.com/file/d/1V3GwUGKBhvXT5Ab1fDy7Ek27x-1Q4Nny/view?usp=drive_link) --- - ## 🧾 Official Questions & Solutions -| Question # | Title / Short Description | Question (Download) | Official Solution (Download) | -|------------|---------------------------------------------------------------|---------------------------------------------------------------|------------------------------------------------------------------| -| Q1 | Simple I/O and variables — read two numbers and print the sum | [Download PDF](./workshops/01-q1-question.pdf) | [01-q1-solution.cpp](./workshops/01-q1-solution.cpp) | -| Q2 | Type conversion — integer division vs floating point | [Download PDF](./workshops/01-q2-question.pdf) | [01-q2-solution.cpp](./workshops/01-q2-solution.cpp) | -| Q3 | Using `` — compute and format results | [Download PDF](./workshops/01-q3-question.pdf) | [01-q3-solution.cpp](./workshops/01-q3-solution.cpp) | -| Q4 | Edge cases & input validation | [Download PDF](./workshops/01-q4-question.pdf) | [01-q4-solution.cpp](./workshops/01-q4-solution.cpp) | +| Question # | Question (Download) | Official Solution (Download) | Additional Notes | +| ---------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------- | +| 01 | [Download PDF](https://drive.google.com/file/d/1mQd1oFr605IYz8SFA0u07_tt8w5ibEIp/view?usp=sharing) | [Download Solution (zip)](https://drive.google.com/file/d/1suqDVN3OtZDS4EnfJInVoM1tal6QWUit/view?usp=drive_link) | | +| 02 | [Download PDF](https://drive.google.com/file/d/1mv7Mp3gxYSK1r-OH5h88ueJMSUCSC-Gc/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1UUlwNpQvdQU7S_h_azYSAudxsZKi6NtW/view?usp=drive_link) | | +| 03 | [Download PDF](https://drive.google.com/file/d/1FT1YFfGDekytEDnRd2wNThTNRIJ0Gtvx/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1vtC4GwdEd2Q3YSos9FWzJeYEJy_4gwuu/view?usp=drive_link) | | +| 04 | [Download PDF](https://drive.google.com/file/d/1ql1-JOaNArnH4aHjOvZkmWqYyDFcAKsV/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/17gfm6Ocl1RrA57FLJC4DS2-hn_gvVfFZ/view?usp=drive_link) | | > [!note] Not available yet? > Some solutions will be uploaded after the workshop or assignment deadline. Check back later or ask your TA. --- - ## ❓ Q&A and Support > [!question] Got stuck or confused? > If something in a question or solution is unclear: > - Revisit the lecture notes and workshop slides. -> - Check the [Q&A page](../resources/qa.md) for clarifications. > - Ask your TA — that’s what we’re here for. -- [Topic Q&A](../resources/qa.md) -- [Workshop Slides](./workshops/01-basics-data-types/slides.pdf) -- [Professor Slides](../lectures/01-data-types/professor-slides.pdf) - +- [Topic Q&A](01-topics/02-basics-and-data-types/3-Q&A.md) +- [Professor Slides](01-topics/02-basics-and-data-types/4-ProfessorSlides.md) +- [TA Slides](01-topics/02-basics-and-data-types/5-TASlides.md) --- - -## 🙏 Acknowledgements - -> [!success] Special thanks -> These materials were created collaboratively to support your learning. -> - You are encouraged to use and adapt the solutions **for learning**, not copying. -> - If you find an error or have a better solution, you can suggest an improvement. -> - TA and instructor feedback will be added over time. - ---- - ## ⚖️ Licensing & Usage > [!important] Usage note -> Official workshop solutions are for **educational use only**. Please do not repost them publicly or use them in ways that violate course policy. +> Official assignment solutions are for **educational use only**. Please do not repost them publicly or use them in ways that violate course policy. diff --git a/src/content/01-topics/02-basics-and-data-types/2-Assignment.md b/src/content/01-topics/02-basics-and-data-types/2-Assignment.md index a3c048c..44740a0 100644 --- a/src/content/01-topics/02-basics-and-data-types/2-Assignment.md +++ b/src/content/01-topics/02-basics-and-data-types/2-Assignment.md @@ -9,34 +9,29 @@ > - Start by attempting each question on your own. > - Use the official solutions only to review and learn better approaches. > - If something doesn’t make sense, **ask a TA**. -> - Check the [Q&A page](../resources/qa.md) for common questions and clarifications. --- -| Concept | Example Keywords | -| -------------- | ----------------------------- | -| Input/Output | `cin`, `cout`, `setprecision` | -| Integer math | `/`, `%`, precedence | -| Floating-point | rounding, precision | -| Math library | `sqrt`, `pow`, `abs` | +## 📦 Download All Questions and Solutions +- **All questions (zip):** [Download all questions](https://drive.google.com/file/d/1SaM7dICduui9NjqiqHTU-5L_AftlvoHE/view?usp=drive_link) +- **All official solutions (zip):** [Download all official solutions](https://drive.google.com/file/d/1V3GwUGKBhvXT5Ab1fDy7Ek27x-1Q4Nny/view?usp=drive_link) --- - -## 📦 Download All Solutions - -- **All official solutions (zip):** [Download all official solutions](./workshops/01-basics-data-types/official-solutions.zip) - ---- - ## 🧾 Official Questions & Solutions -| Question # | Title / Short Description | Question (Download) | Official Solution (Download) | -|------------|---------------------------------------------------------------|---------------------------------------------------------------|------------------------------------------------------------------| -| Q1 | Simple I/O and variables — read two numbers and print the sum | [Download PDF](./workshops/01-q1-question.pdf) | [01-q1-solution.cpp](./workshops/01-q1-solution.cpp) | -| Q2 | Type conversion — integer division vs floating point | [Download PDF](./workshops/01-q2-question.pdf) | [01-q2-solution.cpp](./workshops/01-q2-solution.cpp) | -| Q3 | Using `` — compute and format results | [Download PDF](./workshops/01-q3-question.pdf) | [01-q3-solution.cpp](./workshops/01-q3-solution.cpp) | -| Q4 | Edge cases & input validation | [Download PDF](./workshops/01-q4-question.pdf) | [01-q4-solution.cpp](./workshops/01-q4-solution.cpp) | +| Question # | Question (Download) | Official Solution (Download) | Additional Notes | +| ---------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------- | +| 01 | [Download PDF](https://drive.google.com/file/d/1mQd1oFr605IYz8SFA0u07_tt8w5ibEIp/view?usp=sharing) | [Download Solution (zip)](https://drive.google.com/file/d/1suqDVN3OtZDS4EnfJInVoM1tal6QWUit/view?usp=drive_link) | | +| 02 | [Download PDF](https://drive.google.com/file/d/1mv7Mp3gxYSK1r-OH5h88ueJMSUCSC-Gc/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1UUlwNpQvdQU7S_h_azYSAudxsZKi6NtW/view?usp=drive_link) | | +| 03 | [Download PDF](https://drive.google.com/file/d/1FT1YFfGDekytEDnRd2wNThTNRIJ0Gtvx/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1vtC4GwdEd2Q3YSos9FWzJeYEJy_4gwuu/view?usp=drive_link) | | +| 04 | [Download PDF](https://drive.google.com/file/d/1ql1-JOaNArnH4aHjOvZkmWqYyDFcAKsV/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/17gfm6Ocl1RrA57FLJC4DS2-hn_gvVfFZ/view?usp=drive_link) | | +| 05 | [Download PDF](https://drive.google.com/file/d/1ev7SrFO4kdSkPn7ZX8z148QptLDJVpmG/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1OuI3u81ll6-GKARoVYUEjabFaHTINyKm/view?usp=drive_link) | | +| 06 | [Download PDF](https://drive.google.com/file/d/1cSJwqGXNXzu8foMDh9585VM6MzkQ1TKH/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1alVdHcCxrTcCIH0wZbS6CDCCmDclNaRH/view?usp=drive_link) | | +| 07 | [Download PDF](https://drive.google.com/file/d/1klayxpRC-EIC_E7S_-SnOojA3lUmuNrZ/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/11pjUFIcS83qcy7Ac5l8DHL-EEgkVO5NE/view?usp=drive_link) | | +| 08 | [Download PDF](https://drive.google.com/file/d/18yKwoek6fmrSaUZWF79rrIn5BGS0GUIK/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1OuPGpJgkfB8BHoDlMaTDnlRn9NhyLDdA/view?usp=drive_link) | | +| 09 | [Download PDF](https://drive.google.com/file/d/1i9XugaK_iqJlgaWemrrZbYxNlGmXsm9d/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/1Ppni5K6EQZF2mqVR_u6dq7NyXS-eHZ-1/view?usp=drive_link) | | +| 10 | [Download PDF](https://drive.google.com/file/d/1ihsQfgfZp7wWRt33lm3-ZPAnkQ0I5bv4/view?usp=drive_link) | [Download Solution (zip)](https://drive.google.com/file/d/110ieA_9qNIyvweunLKChcQHcraSeoWI6/view?usp=drive_link) | | > [!note] Not available yet? > Some solutions will be uploaded after the workshop or assignment deadline. Check back later or ask your TA. @@ -48,25 +43,12 @@ > [!question] Got stuck or confused? > If something in a question or solution is unclear: > - Revisit the lecture notes and workshop slides. -> - Check the [Q&A page](../resources/qa.md) for clarifications. > - Ask your TA — that’s what we’re here for. -- [Topic Q&A](../resources/qa.md) -- [Workshop Slides](./workshops/01-basics-data-types/slides.pdf) -- [Professor Slides](../lectures/01-data-types/professor-slides.pdf) - +- [Topic Q&A](01-topics/02-basics-and-data-types/3-Q&A.md) +- [Professor Slides](01-topics/02-basics-and-data-types/4-ProfessorSlides.md) +- [TA Slides](01-topics/02-basics-and-data-types/5-TASlides.md) --- - -## 🙏 Acknowledgements - -> [!success] Special thanks -> These materials were created collaboratively to support your learning. -> - You are encouraged to use and adapt the solutions **for learning**, not copying. -> - If you find an error or have a better solution, you can suggest an improvement. -> - TA and instructor feedback will be added over time. - ---- - ## ⚖️ Licensing & Usage > [!important] Usage note diff --git a/src/content/01-topics/02-basics-and-data-types/3-Q&A.md b/src/content/01-topics/02-basics-and-data-types/3-Q&A.md index c6089b1..ab6f921 100644 --- a/src/content/01-topics/02-basics-and-data-types/3-Q&A.md +++ b/src/content/01-topics/02-basics-and-data-types/3-Q&A.md @@ -8,10 +8,6 @@ For example: > - `int x = 5;` > - `float y = 5.25;` -📚 **Read more:** -- [Professor Slides](https://chatgpt.com/Slides/Topic.pdf) -- [Workshop Slides](https://chatgpt.com/Workshop/Workshop.pdf) -- [External Resource](https://cplusplus.com/doc/tutorial/variables/) --- @@ -21,8 +17,3 @@ For example: > [!info] Answer > Semicolons mark the end of a statement in C++. They help the compiler understand where one command finishes and the next begins. Without it, the compiler throws an error. - -📚 **Read more:** -- [Professor Slides](https://chatgpt.com/Slides/Topic.pdf) -- [External Resource](https://www.geeksforgeeks.org/basics-of-cpp/) - diff --git a/src/content/01-topics/02-basics-and-data-types/4-ProfessorSlides.md b/src/content/01-topics/02-basics-and-data-types/4-ProfessorSlides.md new file mode 100644 index 0000000..3d08c28 --- /dev/null +++ b/src/content/01-topics/02-basics-and-data-types/4-ProfessorSlides.md @@ -0,0 +1,13 @@ +## 🔗 Download +- [Download PDF - Lecture 00](https://drive.usercontent.google.com/u/0/uc?id=1w74gIFxcbs1syPYu0-0a-FotyODGZUre&export=download) +- [Download PDF - Lecture 01](https://drive.usercontent.google.com/u/0/uc?id=1FH66cV52t3YQtaCpUlsx0ulSdW-oZNeH&export=download) +## View PDF Online +### Lecture 00 + + +--- +### Lecture 01 + + + + diff --git a/src/content/01-topics/02-basics-and-data-types/5-TASlides.md b/src/content/01-topics/02-basics-and-data-types/5-TASlides.md new file mode 100644 index 0000000..d7ba560 --- /dev/null +++ b/src/content/01-topics/02-basics-and-data-types/5-TASlides.md @@ -0,0 +1,11 @@ +## 🔗 Download +- [Download PDF Part 1: Computer 101](https://drive.usercontent.google.com/u/0/uc?id=1h4Yk1D-PgJHz0mgqiXTq_klk40LF9B_G&export=download) +- [Download PDF Part 2: Data Types](https://drive.usercontent.google.com/u/0/uc?id=1d5GhbYiw1JVPTZDxDrBKPYX-r6m0qqol&export=download) +## View PDF Online + +### Computer 101 + + +### Data Types + + diff --git a/src/content/01-topics/03-conditions-loops/0-Overview.md b/src/content/01-topics/03-conditions-loops/0-Overview.md new file mode 100644 index 0000000..2e28687 --- /dev/null +++ b/src/content/01-topics/03-conditions-loops/0-Overview.md @@ -0,0 +1,157 @@ +# 🧭 Topic: C++ Control Structures + + +> [!info] Quick Overview +> + +--- +## 📌 Covered in This Topic + +### Part 1 - Conditions +- Introduction to Control Structures + - What are _control structures_ and why they matter + - How conditions allow decision-making in programs + - Types of control flow in C++: + - Sequential + - Selection (branching — **this lecture’s focus**) + - Iteration (to be covered later) +- 2. Operators and Their Categories + - Overview: Operators as tools for computation and logic + - Main categories relevant to conditions: + - **Arithmetic operators** (`+`, `-`, `*`, `/`, `%`) – for expressions inside conditions + - **Comparison / Relational operators** ` ==, !=, <, >, <=, >=` + - Logical operators (`&&`, `||`, `!`) + - Bitwise operators (intro only) (`&`, `|`, `^`, `~`, `<<`, `>>`) + - Distinguish between _bitwise_ and _logical_ operations + - Simple binary truth table demonstration + +- Boolean Expressions and Truth Evaluation + - How C++ evaluates boolean expressions (`true`, `false`, `0`, `non-zero`) + - Short-circuit evaluation with `&&` and `||` + - Expression combinations and nested conditions + - Boolean variables and expressions (`bool is_valid = age > 18;`) + +- Conditional Statements + - The `if` Statement** + - Basic syntax and flow + - Single-statement vs block (`{}`) forms + - Recommended: **always use braces** for clarity and safety + - Readability and indentation rules + - if...else` and `else if Chains + - Multi-condition logic + - Execution flow and exclusivity (only one branch executes) + - Common pitfalls (missing `else`, overlapping conditions) +- Nested `if` Statements + - When to nest vs when to restructure + - Clean and readable formatting examples + - Introduce the idea of _early return_ or _guard clauses_ as clean code alternatives + +- The Ternary Operator (`?:`)** + - Syntax and usage + - Example: `result = (x > 0) ? 1 : -1;` + - When to use vs when not to use + - _“Short-hand if”_ — only for **simple assignments or expressions** + - Readability trade-offs + +- The `switch` Statement + - Purpose and syntax + - Supported data types: + - `int`, `char`, `enum`, `bool` (and C++11 `constexpr` integral types) + - ⚠️ Not supported: `float`, `double`, `string` +- **Case labels** and the need for `break` +- **Default** case and its importance +- Fall-through behavior (intentional vs accidental) +- Example: menu-based program with `switch` + +- Operator Precedence and Associativity** + - Order in which operators are evaluated + - Why parentheses improve readability and prevent bugs + - Quick reference table for comparison, logical, and arithmetic operators + - Example comparisons showing subtle precedence mistakes + +- Clean Code and Best Practices** + - Always use braces `{}` even for single statements + - Align and indent consistently + - Use descriptive variable and condition names (`if (is_authenticated)` not `if (x)`) + - Avoid deeply nested conditions (refactor with functions or early returns) + - Comment _why_ not _what_ + - Test all branches (especially edge cases and default paths) + +--- +### Part 2 - Loops +- **Introduction to Iteration** + - Why repetition is needed in programs + - The concept of control flow — branching vs looping +- **The `while` Loop** + - Syntax and structure + - Flow of control in `while` + - Typical use cases: input validation, sentinel-controlled loops + - Common pitfalls (infinite loops, missing updates) +- **The `do-while` Loop** + - Difference between `while` and `do-while` (post-test vs pre-test) + - When to use `do-while` (menus, repeated input until valid) +- **The `for` Loop** + - Syntax and structure (`initialization`, `condition`, `update`) + - Iterating over numeric ranges + - Loop variable scope and lifetime + - Variations: multiple initializations, empty components + - Using `for` for counting and fixed iterations +- **Loop Control Statements** + - `break` — exiting early + - `continue` — skipping to next iteration + - `return` in loops + - Discuss readability vs misuse of these +- **Nested Loops** + - How inner loops behave relative to outer loops + - Common examples: printing patterns, working with 2D arrays + - Complexity growth and performance intuition (Brief) +- **Loop Design Patterns** + - Counter-controlled loops + - Sentinel-controlled loops + - Flag-controlled loops + - Infinite loops with `break` condition +- **Order of Execution Recap** + - Loop initialization → condition check → body → update + - Flow diagrams to illustrate control +- **Best Practices and Clean Code** + - Avoid “magic numbers” — use constants in loop bounds + - Use meaningful variable names (`i`, `j` are fine for indices, otherwise be descriptive) + - Ensure loops have clear termination conditions + - Maintain consistent indentation and brace style +- **Debugging and Tracing Loops** + - Using print statements to track variables + - Recognizing off-by-one errors + + + + +## 📑 Slides & Materials +- 👨‍🏫 [Professor Slides (PDF)](./4-ProfessorSlides.md) +- 🧑‍🏫 [TA Workshop Slides (PDF)](./5-TASlides) + +--- +## 🛠️ Workshop & Assignments + +- 💬 [Workshop Questions](./1-Workshop) +- 🧮 [Assignments](01-topics/01-problem-solving/2-Assignment.md) +- ❓ [Q&A and Common Issues](./3-Q&A.md) + +--- +## 🌐 Additional Resources + +- [C++ Reference](https://cplusplus.com/reference/) +- [Learn C++](https://www.learncpp.com/) +- [Data Types in C++ (W3Schools)](https://www.w3schools.com/cpp/cpp_data_types.asp) + +_Add more useful links here as the course progresses._ + +--- +## ⏩ Navigation + +- ⬅️ [Previous Topic: Problem Solving](../02-problem-solving/topic.md) +- ➡️ [Next Topic: Conditions & Loops](../04-conditions-loops/topic.md) +--- + +> [!tip] Tip +> If something doesn’t make sense — **don’t stay stuck alone**. Ask the TA to clarify it right away. Often, a quick question can save you a lot of time and frustration. Remember: if you’re confused, chances are others are too. + diff --git a/src/content/01-topics/03-conditions-loops/4-ProfessorSlides.md b/src/content/01-topics/03-conditions-loops/4-ProfessorSlides.md new file mode 100644 index 0000000..3f57727 --- /dev/null +++ b/src/content/01-topics/03-conditions-loops/4-ProfessorSlides.md @@ -0,0 +1,6 @@ +## 🔗 Download +- [Download PDF](INSERT_DOWNLOAD_URL_HERE) +## View PDF Online + + + diff --git a/src/content/01-topics/03-conditions-loops/5-TASlides.md b/src/content/01-topics/03-conditions-loops/5-TASlides.md new file mode 100644 index 0000000..0973fd7 --- /dev/null +++ b/src/content/01-topics/03-conditions-loops/5-TASlides.md @@ -0,0 +1,6 @@ +## 🔗 Download +- [Download PDF](https://drive.google.com/file/d/1_e2c5by8f2r-sWSpjnioXWm16mUZFTtp/view?usp=sharing) +## View PDF Online + + +