Skip to content

Commit 80c9ce3

Browse files
committed
fixes in the doc structure
1 parent 67846bd commit 80c9ce3

File tree

6 files changed

+27
-13
lines changed

6 files changed

+27
-13
lines changed

Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/arrow/arrow.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Print a vertical arrow on the console, in which "**`#`**" (number sign) marks th
2525
From the explanation we see that **the input data** will be read from one input line only, which will contain **an integer** within the range [**3 … 1000**]. This is why we will use **a variable** of **`int`** type.
2626

2727
![](/assets/chapter-6-2-images/04.Arrow-01.png)
28+
29+
### Divide the Figure into Parts
2830
2931
We can divide the figure into **3 parts** – upper, middle and lower one. **The upper part** contains two sub-parts – a first row and a body of the arrow. We can see from the examples that the count of **the outer dots** on the first row and in the body of the arrow is **`(n - 1) / 2`**. We can write this value in **a variable** **`outerDots`**.
3032

@@ -38,7 +40,7 @@ We can see from the examples the structure of the first row. We must use the dec
3840

3941
![](/assets/chapter-6-2-images/04.Arrow-04.png)
4042

41-
## Printing the Body and the Middle Row of the Arrow
43+
### Printing the Body and the Middle Row of the Arrow
4244

4345
In order to draw **the body of the arrow**, we need to create **a loop**, which runs **`n - 2`** times.
4446

@@ -48,7 +50,7 @@ In order to draw **the body of the arrow**, we need to create **a loop**, which
4850

4951
![](/assets/chapter-6-2-images/04.Arrow-06.png)
5052

51-
## Printing the Lower Part of the Arrow
53+
### Printing the Lower Part of the Arrow
5254

5355
In order to draw **the lower part of the arrow**, we need to assign new values to **the variables** **`outerDots`** and **`innerDots`**.
5456

Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/axe/axe.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ In order to solve the problem, we first need to calculate **the dashes in the le
2626

2727
![](/assets/chapter-6-2-images/05.Axe-01.png)
2828

29+
### Divide the Figure into Parts
30+
31+
We divide the figure into 3 parts: upper part, middle part (the handle), down part.
32+
2933
After we have declared and initialized **the variables**, we can begin drawing the figure by starting with **the upper part**. We can see from the examples what the structure of **the first row** is, and we can create a loop, which runs **`n`** times. At each iteration of the loop **the middle dashes** increase by 1, and **the right dashes** decrease by 1.
3034

3135
![](/assets/chapter-6-2-images/05.Axe-02.png)
@@ -34,13 +38,13 @@ In order to use again **the variables** that we created in order to draw the han
3438

3539
![](/assets/chapter-6-2-images/05.Axe-03.png)
3640

37-
## Printing the Handle
41+
### Printing the Handle
3842

3943
We can draw **the handle of the axe** by creating a loop, which runs **`n - 2`** times. We can see in the examples what its structure is.
4044

4145
![](/assets/chapter-6-2-images/05.Axe-04.png)
4246

43-
## Printing the Lower Part of the Axe
47+
### Printing the Lower Part of the Axe
4448

4549
We need to divide **the lower part** of the figure into two sub-parts – **head of the axe** and **the last row of the figure**. We will print **the head of the axe** on the console by creating a loop that runs **`n / 2 - 1`** times. At each iteration **the left dashes** and **the right dashes** decrease by 1, and **the middle dashes** increase by 2.
4650

Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/butterfly/butterfly.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ We can see in the explanation that **the input data** will be taken from only on
2626

2727
![](/assets/chapter-6-2-images/02.Butterfly-01.png)
2828

29+
### Divide the Figure into Parts
30+
2931
We can divide the figure into 3 parts – upper wing, body and lower wing. In order to draw the upper wing, we need to divide it into parts – beginning **`*`**, middle part **`\ /`** and end **`*`**. After looking at the examples we find out that the beginning is with size **`n - 2`**.
3032

3133
![](/assets/chapter-6-2-images/02.Butterfly-02.png)
@@ -38,7 +40,7 @@ We can see in the examples that on an even row we have a beginning **`*`**, a mi
3840

3941
![](/assets/chapter-6-2-images/02.Butterfly-04.png)
4042

41-
## Printing the Body and the Lower Wing
43+
### Printing the Body and the Lower Wing
4244

4345
In order to create **the body of the butterfly** we can use **the variable** **`halfRowSize`** again and print on the console exactly **one** row. The body structure begins with **`(white space)`**, middle **`@`** and ends with **`(white space)`**.
4446

Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/draw-fort/draw-fort.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ Print on the console **n** text rows, depicting **the fort** exactly as in the e
2020
|----|----|----|----|
2121
|5|<code>&#47;&#94;&#94;&#92;&#95;&#95;&#47;&#94;&#94;&#92;</code><br><code>&#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;</code><br><code>&#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;</code><br><code>&#124;&nbsp;&nbsp;&nbsp;&#95;&#95;&nbsp;&nbsp;&nbsp;&#124;</code><br><code>&#92;&#95;&#95;&#47;&nbsp;&nbsp;&#92;&#95;&#95;&#47;</code><br>|8|<code>&#47;&#94;&#94;&#94;&#94;&#92;&#95;&#95;&#95;&#95;&#47;&#94;&#94;&#94;&#94;&#92;</code><br><code>&#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;</code><br><code>&#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;</code><br><code>&#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;</code><br><code>&#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;</code><br><code>&#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;</code><br><code>&#124;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#95;&#95;&#95;&#95;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#124;</code><br><code>&#92;&#95;&#95;&#95;&#95;&#47;&nbsp;&nbsp;&nbsp;&nbsp;&#92;&#95;&#95;&#95;&#95;&#47;</code><br>|
2222

23-
## Reading the Input Data
23+
## Hints and Guidelines
24+
25+
Let’s solve the problem step by step: read the input, perform some calculations, print the fort roof, print the fort body, print the fort base.
26+
27+
### Reading the Input Data
2428

2529
We can see from the explanation that **the input data** will be only one line which will contain **an integer** within the range [**3 … 1000**]. Therefore, we will use **a variable** of **`int`** type.
2630

@@ -31,7 +35,7 @@ After we have declared and initialized the input data, we must divide **the fort
3135
* body
3236
* base
3337

34-
## Calculating and Printing the Roof
38+
### Calculating and Printing the Roof
3539

3640
We can see from the examples that **the roof** is made of **two towers** and **a middle part**. Each tower has a beginning **`/`**, middle part **`^`** and an end **`\`**.
3741

@@ -51,13 +55,13 @@ In order to print **the roof**, we will use **`new string`**, which takes two pa
5155

5256
![](/assets/chapter-6-2-images/01.Draw-fort-04.png)
5357

54-
## Printing the Body of the Fort
58+
### Printing the Body of the Fort
5559

5660
**The body of the fort** contains a beginning **`|`**, a middle part **`(white space)`** and an end **`|`**. **The middle part** is a blank space with size of **`2 * n - 2`**. The number of **the rows** used for walls can be found in the given parameters: **`n - 3`**. This code prints the body of the fort:
5761

5862
![](/assets/chapter-6-2-images/01.Draw-fort-05.png)
5963

60-
## Printing the Base of the Fort
64+
### Printing the Base of the Fort
6165

6266
In order to draw the last but one row, which is a part of the base, we need to print a beginning **`|`**, middle part **`(white space)_(white space)`** and an end **`|`**. In order to do this, we can use the already declared variables **`colSize`** and **`midSize`** again, because we can see from the examples that they are equal to the **`_`** in the roof.
6367

Content/Chapter-6-2-nested-loops-exam-problems/exam-problems/stop/stop.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ We can see from the explanation that **the input data** will come from only one
2626

2727
![](/assets/chapter-6-2-images/03.Stop-01.png)
2828

29+
### Divide the Figure into Parts
30+
2931
We can **divide** the figure into **3 parts** – upper, middle and lower. **The upper part** contains two sub-parts – first row and rows in which the sign widens. **The first row** is made of a beginning **`.`**, middle part **`_`** and an end **`.`**. After looking at the examples we can say that the beginning is **`n + 1`** columns wide, so it is good to write this **value** in a separate **variable**.
3032

3133
![](/assets/chapter-6-2-images/03.Stop-02.png)
@@ -38,7 +40,7 @@ After we have declared and initialized the two variables, we can print the first
3840

3941
![](/assets/chapter-6-2-images/03.Stop-04.png)
4042

41-
## Printing the Upper Part of the Sign
43+
### Printing the Upper Part of the Sign
4244

4345
In order to draw the rows in which the sign is getting **"wider"**, we need to create **a loop**, which runs **`n`** times. The structure of a row contains a beginning **`.`**, **`//`** + middle part **`_`** + **`\\`** and an end **`.`**. In order to reuse the already created **variables**, we need to decrease **`dots`** by 1 and **`underscores`** by 2, because we have already **printed** the first row, and the dots and underscores in the upper part of the figure are **decreasing**.
4446

@@ -48,7 +50,7 @@ In each following iteration **the beginning** and **the end** decrease by 1, and
4850

4951
![](/assets/chapter-6-2-images/03.Stop-06.png)
5052

51-
## Printing the Middle Row and the Lower Part of the Sign
53+
### Printing the Middle Row and the Lower Part of the Sign
5254

5355
**The middle part** of the figure begins with **`//`** + **`_`**, middle part **`STOP!`** and an end **`_`** + **`\\`**. The count of the underscores **`_`** is **`(underscores - 5) / 2`**.
5456

Content/Chapter-7-2-complex-loops-exam-problems/stupid-password-generator/stupid-password-generator.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ We can split the solution of the problem into 3 parts:
3333
* **Processing the input data** – using of nested loops to iterate through every possible symbol for each of the five password symbols.
3434
* **Printing the output** – printing every "dumb" password that meets the requirements.
3535

36-
## Reading the Input Data
36+
### Reading the Input Data
3737

3838
For **reading** of **input** data we will declare two integer variables **`int`**: **`n`** and **`l`**.
3939

4040
![](/assets/chapter-7-exam-preparation-images/01.stupid-password-generator-1.png)
4141

4242
Let's declare and initialize the **variables** that will store the **characters** of the password: for the characters of **digit** type – **`int`****`d1`**, **`d2`**, **`d3`**, and for the **letters** – of **`char`** type – **`l1`**, **`l2`**. To make it easier we will skip explicit specification of the type by replacing it with the keyword **`var`**.
4343

44-
## Processing the Input Data and Printing Output
44+
### Processing the Input Data and Printing Output
4545

4646
We need to create **five** **`for`** nested loops, one for each variable. To ensure that the last digit **d3** is **greater** than the first two, we will use the built-in function **`Math.Max (...)`**.
4747

0 commit comments

Comments
 (0)