feat: add content

This commit is contained in:
2025-11-07 18:48:00 +03:30
parent 2841af195e
commit d43833ed57
10 changed files with 317 additions and 71 deletions
@@ -1,46 +1,43 @@
# 🧭 Topic: Basics of C++ & Data Types
# 🧭 Topic: Problem Solving
> [!info] Quick Overview
> This topic introduces how to compile and run C++ code, basic input/output, variables, built-in data types, and the math library.
> By the end, students will be able to write simple C++ programs using variables and standard input/output streams.
> This foundational topic introduces the core skill of programming: problem-solving. It's not about writing code immediately, but about learning how to think logically and systematically. We will explore how to break down complex problems into smaller, manageable steps using a structured approach. By the end of this lecture, students will understand the principles of algorithmic thinking and be able to plan solutions using tools like flowcharts and pseudocode before writing a single line of code.
---
## 📌 Covered in This Topic
- Introduction to compilation and code editors
- `cin` / `cout` basic usage
- Variables and naming conventions
- Built-in data types (`int`, `float`, `double`, `char`, `bool`)
- Type conversion
- Using the math library
- **The Art of Problem Solving:** An introduction to planning, creativity, innovation, and clearly defining the cause, goal, and potential solutions to a problem.
*   **Stages of Algorithmic Thinking:** A 7-step logical process for solving problems:
    1.  Define the Problem
    2.  Analyze and Understand
    3.  Identify Potential Solutions
    4.  Evaluate and Choose a Solution
    5.  Plan Actions
    6.  Implement the Code
    7.  Review the Results
*   **What is an Algorithm?** Defining an algorithm as a step-by-step procedure or a recipe for solving a problem.
*   **Introduction to Flowcharts:** Learning to visualize the flow of a solution using standard symbols to represent actions, decisions, and data flow.
*   **Introduction to Pseudocode:** Understanding how to write a plain-language, structured description of an algorithm's steps before translating it into a programming language.
*   **Choosing the Best Algorithm:** An introduction to the criteria for evaluating different solutions, focusing on time and space efficiency, reliability, and simplicity.
---
## 📑 Slides & Materials
- 👨‍🏫 [Professor Slides (PDF)](./slides/prof.pdf)
- 🧑‍🏫 [TA Workshop Slides (PDF)](./slides/ta.pdf)
---
## 🛠️ Workshop & Assignments
- 💬 [Workshop Questions](./workshops)
- 🧮 [Assignments](01-topics/01-problem-solving/1-Workshop.md)
- ❓ [Q&A and Common Issues](./resources/qa.md)
- 🧮 [Assignments](2-Assignment.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)
- [Next Topic: Basics of C++ & Data Types](../02-basics-and-data-types/0-Overview.md)
---
@@ -21,12 +21,12 @@
## 🧾 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 `<cmath>` — 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 # | 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 `<cmath>` — 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.
@@ -43,7 +43,6 @@
- [Topic Q&A](../resources/qa.md)
- [Workshop Slides](./workshops/01-basics-data-types/slides.pdf)
- [Professor Slides](../lectures/01-data-types/professor-slides.pdf)
---
@@ -21,12 +21,12 @@
## 🧾 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 `<cmath>` — 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 # | 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 `<cmath>` — 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.
@@ -1,28 +0,0 @@
## ❓ Question 1
> Question: _“Whats the difference between `int` and `float` in C++?”_
> [!info] **Answer**
> `int` stores whole numbers without decimals, while `float` stores numbers with fractional parts.
> 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/)
---
### ❓ Question 2
> Question: _“Why do I need to use semicolons in C++?”_
> [!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/)
@@ -1,18 +1,82 @@
# 🧭 Topic: Basics of C++ & Data Types
> [!info] Quick Overview
> This topic introduces how to compile and run C++ code, basic input/output, variables, built-in data types, and the math library.
> By the end, students will be able to write simple C++ programs using variables and standard input/output streams.
---
## 📌 Covered in This Topic
### Part 1 - Basics of C++
- **History and Evolution of Computing**
- Origin of the term _computer_
- Early computing devices
- Milestones in computer development
- **Binary and Logic Fundamentals**
- Why computers use binary
- Boolean logic and logic gates (AND, OR, NOT, XOR)
- Truth tables and simple logic circuits
- 32-bit vs 64-bit systems
- Data representation:
- Number systems (binary, decimal, hexadecimal)
- Signed numbers in binary
- Floating-point representation
- Character encoding: ASCII and Unicode
- **Introduction to Programming Languages**
- From machine code to assembly
- Evolution of high-level languages
- C++ in context: use cases and characteristics
- Low-level vs high-level abstraction
- **Compilers and Program Execution**
- How code becomes machine-executable
- Compiler vs interpreter
- Compilation workflow in C++
- **First Steps in C++ Programming**
- Writing and compiling a simple C++ program
- Basic input and output (`cin`, `cout`)
- Adding comments and documentation
### Part 2 - Data Types and Variables
- Introduction to compilation and code editors
- `cin` / `cout` basic usage
- Variables and naming conventions
- Built-in data types (`int`, `float`, `double`, `char`, `bool`)
- Type conversion
- Using the math library
1. **Understanding Data in Programming**
- What is _data_ and how its represented in memory
- Relationship between data and variables
2. **Variables and Memory Basics**
- Declaring and initializing variables
- Variable scope and lifetime (brief intro)
3. **Fundamental Data Types in C++**
- Overview of primitive types (`int`, `float`, `double`, `char`, `bool`)
- Memory sizes and limits of each data type
- Signed vs unsigned integers
4. **Integers**
- Integer arithmetic and overflow behavior
- Type modifiers (`short`, `long`, `unsigned`)
5. **Floating-Point Numbers**
- Representation and precision limits
- Common rounding and comparison pitfalls
- Differences between `float`, `double`, and `long double`
6. **Characters and Text**
- Character literals and ASCII table
- Escape sequences and their meaning
- Brief Introduction to Unicode and text encoding
- Working with `std::string`
7. **Booleans and Logic**
- Boolean literals and expressions
- Type conversions to and from boolean
8. **Constants and Immutability**
- Declaring constants using `const`
- Benefits of using constants in programs
9. **Type Conversion and Casting**
- Implicit vs explicit type conversion
- `static_cast`, and C-style casts (intro level)
10. **Assignment and Operators**
- Simple and compound assignment
- Operator precedence overview (intro level)
11. **Naming Conventions and Code Style**
- Common naming conventions in C++
- Writing clean and readable variable names
12. **Math Library Overview**
- Using `<cmath>` for basic mathematical operations
- Common functions (`sqrt`, `pow`, `abs`, `round`, etc.)
---
## 📑 Slides & Materials
@@ -46,3 +110,10 @@ _Add more useful links here as the course progresses._
> [!tip] Tip
> If something doesnt make sense — **dont 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 youre confused, chances are others are too.
@@ -11,6 +11,16 @@
> - If something doesnt 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 Solutions