Converted everything to orgmode
converted everything to orgmode and added solution to the README files
@@ -1,19 +0,0 @@
|
||||
# Project overview
|
||||
|
||||
The goal of this project is to implement a game called _Dots And Boxes_: two players, **A** and **B**, take turns to draw lines connecting dots on a $m \times n$ (here $2 \times 2$) board.
|
||||
|
||||
If a player manages to close a box (a $1 \times 1$ square surrounded by lines), the player claims the box by placing its token (**A/B**) in the box, and the player gets another turn. The game is finished when all boxes have been claimed, and the player with the most claimed boxes wins. Note that, even if a player claims multiple boxes in a single move, they would only get one extra move.
|
||||
|
||||
For example, in the following game player **A** won:
|
||||
|
||||

|
||||
|
||||
## Your task
|
||||
|
||||
The file `game.cpp` contains a partial implementation of the game. The main game loop is implemented in the function `play_game(grid)`. This function is called from `main.cpp` and gets the game grid as an argument. The game grid is already fully implemented. We describe the functionality it provides in a following section below.
|
||||
|
||||
Your task is extending the game implementation in file `game.cpp` such that it works the way described above. We provide some functions in this file and thus suggest a certain structure -- but you are completely free to do it your way. Add, remove or change anything you want. The only constraint is that you must implement the function play_game which takes the game grid as argument. You are of course free to change the body of this function in whatever way you like.
|
||||
|
||||
If you do decide to change the body of the play_game function be careful to not accidentally change the format of the outputs it generates. For example: If you change the output `std::cout << "Game finished" << std::endl;` to `std::cout << "Game Finished" << std::endl;` you will not pass some test cases. The autograder is very picky when checking whether or not your outputs are correct. You can get all the points in this exercise without changing any of the output lines in the template.
|
||||
|
||||
_Note_: More Information on the the concept of the game on Code Expert.
|
@@ -1,3 +1,29 @@
|
||||
#+TITLE: Dot and Boxes
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Project overview
|
||||
|
||||
The goal of this project is to implement a game called _Dots And Boxes_: two players, **A** and **B**, take turns to draw lines connecting dots on a \(m \times n\) (here \(2 \times 2\)) board.
|
||||
|
||||
If a player manages to close a box (a \(1 \times 1\) square surrounded by lines), the player claims the box by placing its token (**A/B**) in the box, and the player gets another turn. The game is finished when all boxes have been claimed, and the player with the most claimed boxes wins. Note that, even if a player claims multiple boxes in a single move, they would only get one extra move.
|
||||
|
||||
For example, in the following game player **A** won:
|
||||
|
||||
[[./pictures/dots_and_boxes.svg]]
|
||||
|
||||
* Your task
|
||||
|
||||
The file =game.cpp= contains a partial implementation of the game. The main game loop is implemented in the function =play_game(grid)=. This function is called from =main.cpp= and gets the game grid as an argument. The game grid is already fully implemented. We describe the functionality it provides in a following section below.
|
||||
|
||||
Your task is extending the game implementation in file =game.cpp= such that it works the way described above. We provide some functions in this file and thus suggest a certain structure -- but you are completely free to do it your way. Add, remove or change anything you want. The only constraint is that you must implement the function play_game which takes the game grid as argument. You are of course free to change the body of this function in whatever way you like.
|
||||
|
||||
If you do decide to change the body of the play_game function be careful to not accidentally change the format of the outputs it generates. For example: If you change the output =std::cout << "Game finished" << std::endl;= to =std::cout << "Game Finished" << std::endl;= you will not pass some test cases. The autograder is very picky when checking whether or not your outputs are correct. You can get all the points in this exercise without changing any of the output lines in the template.
|
||||
|
||||
/Note/: More Information on the the concept of the game on Code Expert.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include "game.h"
|
||||
|
||||
#include <assert.h>
|
||||
@@ -240,3 +266,8 @@ void play_game(Grid &grid) {
|
||||
std::cout << "Player " << winner << " wins!" << std::endl;
|
||||
}
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,112 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="26.53125mm"
|
||||
height="26.53125mm"
|
||||
viewBox="0 0 26.53125 26.53125"
|
||||
version="1.1"
|
||||
id="svg4102"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
sodipodi:docname="horizontal_00.svg">
|
||||
<defs
|
||||
id="defs4097" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="3.959798"
|
||||
inkscape:cx="94.057447"
|
||||
inkscape:cy="95.056102"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1003"
|
||||
inkscape:window-x="-9"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4102" />
|
||||
<metadata
|
||||
id="metadata4100">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<rect
|
||||
width="26.25"
|
||||
height="26.25"
|
||||
x="0.140625"
|
||||
y="0.140625"
|
||||
id="rect2987"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28125;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 3.6235642,3.7463729 H 13.267247"
|
||||
id="path3724-7"
|
||||
style="fill:none;stroke:#a00a0a;stroke-width:1.125;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,3.7895896 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,3.7895896 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-8"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,3.7895896 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-5"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,13.26562 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-0"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,13.26562 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-6"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,13.26562 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-4"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,22.74165 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-62"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,22.74165 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-58"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,22.74165 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-628"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
</svg>
|
Before Width: | Height: | Size: 6.7 KiB |
@@ -1,112 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="26.53125mm"
|
||||
height="26.53125mm"
|
||||
viewBox="0 0 26.53125 26.53125"
|
||||
version="1.1"
|
||||
id="svg4102"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
sodipodi:docname="horizontal_21.svg">
|
||||
<defs
|
||||
id="defs4097" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="7.9195959"
|
||||
inkscape:cx="86.150889"
|
||||
inkscape:cy="52.339868"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1003"
|
||||
inkscape:window-x="-9"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4102" />
|
||||
<metadata
|
||||
id="metadata4100">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<rect
|
||||
width="26.25"
|
||||
height="26.25"
|
||||
x="0.140625"
|
||||
y="0.140625"
|
||||
id="rect2987"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28125;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 13.011406,22.689101 h 9.643683"
|
||||
id="path3724-7"
|
||||
style="fill:none;stroke:#a00a0a;stroke-width:1.125;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,3.7895896 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,3.7895896 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-8"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,3.7895896 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-5"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,13.26562 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-0"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,13.26562 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-6"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,13.26562 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-4"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,22.74165 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-62"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,22.74165 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-58"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,22.74165 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-628"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
</svg>
|
Before Width: | Height: | Size: 6.7 KiB |
@@ -1,208 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="26.53125mm"
|
||||
height="26.53125mm"
|
||||
viewBox="0 0 26.53125 26.53125"
|
||||
version="1.1"
|
||||
id="svg4102"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
sodipodi:docname="horizontal_idx.svg">
|
||||
<defs
|
||||
id="defs4097" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="1.979899"
|
||||
inkscape:cx="157.29139"
|
||||
inkscape:cy="50.915658"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1003"
|
||||
inkscape:window-x="-9"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4102"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:snap-to-guides="true">
|
||||
<sodipodi:guide
|
||||
position="10.15811,23.930618"
|
||||
orientation="0,1"
|
||||
id="guide4182"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="5.9531251,20.930432"
|
||||
orientation="1,0"
|
||||
id="guide4184"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="15.686012,20.788691"
|
||||
orientation="1,0"
|
||||
id="guide4186"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="13.313364,14.440907"
|
||||
orientation="0,1"
|
||||
id="guide4188"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="13.41359,4.9862472"
|
||||
orientation="0,1"
|
||||
id="guide4190"
|
||||
inkscape:locked="false" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4100">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<rect
|
||||
width="26.25"
|
||||
height="26.25"
|
||||
x="0.140625"
|
||||
y="0.140625"
|
||||
id="rect2987"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28125;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,3.7895896 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,3.7895896 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-8"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,3.7895896 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-5"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,13.26562 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-0"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,13.26562 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-6"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,13.26562 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-4"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,22.74165 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-62"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,22.74165 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-58"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,22.74165 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-628"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="6.2189474"
|
||||
y="4.508667"
|
||||
id="text4162"
|
||||
transform="scale(0.95386243,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160"
|
||||
x="6.2189474"
|
||||
y="4.508667"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 0,0 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="16.454226"
|
||||
y="4.4836931"
|
||||
id="text4162-1"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-2"
|
||||
x="16.454226"
|
||||
y="4.4836931"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 0,1 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="6.2257996"
|
||||
y="13.564726"
|
||||
id="text4162-5"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-1"
|
||||
x="6.2257996"
|
||||
y="13.564726"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 1,0 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="16.454226"
|
||||
y="13.463326"
|
||||
id="text4162-0"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-5"
|
||||
x="16.454226"
|
||||
y="13.463326"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 1,1 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="6.238183"
|
||||
y="22.533091"
|
||||
id="text4162-4"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-9"
|
||||
x="6.238183"
|
||||
y="22.533091"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 2,0 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="16.454226"
|
||||
y="22.578157"
|
||||
id="text4162-54"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-8"
|
||||
x="16.454226"
|
||||
y="22.578157"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 2,1 </tspan></text>
|
||||
</svg>
|
Before Width: | Height: | Size: 10 KiB |
@@ -1,122 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="26.53125mm"
|
||||
height="26.53125mm"
|
||||
viewBox="0 0 26.53125 26.53125"
|
||||
version="1.1"
|
||||
id="svg4102"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)"
|
||||
sodipodi:docname="isboxdrawn0.svg">
|
||||
<defs
|
||||
id="defs4097" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="5.6"
|
||||
inkscape:cx="78.567572"
|
||||
inkscape:cy="50.641397"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="2004"
|
||||
inkscape:window-x="-16"
|
||||
inkscape:window-y="-16"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4102" />
|
||||
<metadata
|
||||
id="metadata4100">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<rect
|
||||
width="26.25"
|
||||
height="26.25"
|
||||
x="0.140625"
|
||||
y="0.140625"
|
||||
id="rect2987"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28125;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 22.901762,22.588768 H 13.25808"
|
||||
id="path3724-8-7-9-8-1"
|
||||
style="fill:none;stroke:#808080;stroke-width:0.65600002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 22.917891,22.848191 V 13.204509"
|
||||
id="path3724-8-7-9-8-5"
|
||||
style="fill:none;stroke:#808080;stroke-width:0.65600002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 22.917891,13.204509 H 13.274209"
|
||||
id="path3724-8-7-9-8"
|
||||
style="fill:none;stroke:#808080;stroke-width:0.656;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,3.7895896 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,3.7895896 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-8"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,3.7895896 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-5"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,13.26562 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-0"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,13.26562 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-6"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,13.26562 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-4"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,22.74165 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-62"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,22.74165 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-58"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,22.74165 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-628"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
</svg>
|
Before Width: | Height: | Size: 7.3 KiB |
@@ -1,151 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="26.53125mm"
|
||||
height="26.53125mm"
|
||||
viewBox="0 0 26.53125 26.53125"
|
||||
version="1.1"
|
||||
id="svg4102"
|
||||
inkscape:version="0.92.3 (2405546, 2018-03-11)"
|
||||
sodipodi:docname="isboxdrawn1.svg">
|
||||
<defs
|
||||
id="defs4097" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="5.6"
|
||||
inkscape:cx="78.567572"
|
||||
inkscape:cy="50.641397"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="2004"
|
||||
inkscape:window-x="-16"
|
||||
inkscape:window-y="-16"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4102" />
|
||||
<metadata
|
||||
id="metadata4100">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<rect
|
||||
width="26.25"
|
||||
height="26.25"
|
||||
x="0.140625"
|
||||
y="0.140625"
|
||||
id="rect2987"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28125;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 22.901762,22.588768 H 13.25808"
|
||||
id="path3724-8-7-9-8-1"
|
||||
style="fill:none;stroke:#808080;stroke-width:0.65600002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 22.917891,22.848191 V 13.204509"
|
||||
id="path3724-8-7-9-8-5"
|
||||
style="fill:none;stroke:#808080;stroke-width:0.65600002;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="M 22.917891,13.204509 H 13.274209"
|
||||
id="path3724-8-7-9-8"
|
||||
style="fill:none;stroke:#808080;stroke-width:0.656;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 13.274209,13.204509 v 9.643682"
|
||||
id="path3724-8"
|
||||
style="fill:none;stroke:#a00a0a;stroke-width:1.125;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,3.7895896 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,3.7895896 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-8"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,3.7895896 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-5"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,13.26562 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-0"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,13.26562 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-6"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,13.26562 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-4"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,22.74165 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-62"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,22.74165 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-58"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,22.74165 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-628"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<g
|
||||
aria-label="?"
|
||||
transform="matrix(0.26458333,0,0,0.26458333,0.04724703,1.839808)"
|
||||
inkscape:transform-center-x="-0.25985863"
|
||||
inkscape:transform-center-y="-0.8031994"
|
||||
style="font-style:normal;font-weight:normal;font-size:32px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#a00a0a;fill-opacity:1;stroke:none"
|
||||
id="flowRoot5525">
|
||||
<path
|
||||
d="m 28.279298,67.208984 h 3.171875 v 3.96875 h -3.171875 z m 3.078125,-2.296875 h -2.984375 v -2.40625 q 0,-1.578125 0.4375,-2.59375 0.4375,-1.015625 1.84375,-2.359375 l 1.40625,-1.390625 q 0.890625,-0.828125 1.28125,-1.5625 0.40625,-0.734375 0.40625,-1.5 0,-1.390625 -1.03125,-2.25 -1.015625,-0.859375 -2.703125,-0.859375 -1.234375,0 -2.640625,0.546875 -1.390625,0.546875 -2.90625,1.59375 v -2.9375 q 1.46875,-0.890625 2.96875,-1.328125 1.515625,-0.4375 3.125,-0.4375 2.875,0 4.609375,1.515625 1.75,1.515625 1.75,4 0,1.1875 -0.5625,2.265625 -0.5625,1.0625 -1.96875,2.40625 l -1.375,1.34375 q -0.734375,0.734375 -1.046875,1.15625 -0.296875,0.40625 -0.421875,0.796875 -0.09375,0.328125 -0.140625,0.796875 -0.04687,0.46875 -0.04687,1.28125 z"
|
||||
style=""
|
||||
id="path5665" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="?"
|
||||
transform="matrix(0.26458333,0,0,0.26458333,10.163647,1.8401771)"
|
||||
inkscape:transform-center-x="-0.25985863"
|
||||
inkscape:transform-center-y="-0.8031994"
|
||||
style="font-style:normal;font-weight:normal;font-size:32px;line-height:1.25;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#a00a0a;fill-opacity:1;stroke:none"
|
||||
id="flowRoot5525-2">
|
||||
<path
|
||||
d="m 28.279298,67.208984 h 3.171875 v 3.96875 h -3.171875 z m 3.078125,-2.296875 h -2.984375 v -2.40625 q 0,-1.578125 0.4375,-2.59375 0.4375,-1.015625 1.84375,-2.359375 l 1.40625,-1.390625 q 0.890625,-0.828125 1.28125,-1.5625 0.40625,-0.734375 0.40625,-1.5 0,-1.390625 -1.03125,-2.25 -1.015625,-0.859375 -2.703125,-0.859375 -1.234375,0 -2.640625,0.546875 -1.390625,0.546875 -2.90625,1.59375 v -2.9375 q 1.46875,-0.890625 2.96875,-1.328125 1.515625,-0.4375 3.125,-0.4375 2.875,0 4.609375,1.515625 1.75,1.515625 1.75,4 0,1.1875 -0.5625,2.265625 -0.5625,1.0625 -1.96875,2.40625 l -1.375,1.34375 q -0.734375,0.734375 -1.046875,1.15625 -0.296875,0.40625 -0.421875,0.796875 -0.09375,0.328125 -0.140625,0.796875 -0.04687,0.46875 -0.04687,1.28125 z"
|
||||
style=""
|
||||
id="path5668" />
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 10 KiB |
@@ -1,112 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="26.53125mm"
|
||||
height="26.53125mm"
|
||||
viewBox="0 0 26.53125 26.53125"
|
||||
version="1.1"
|
||||
id="svg4102"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
sodipodi:docname="vertical_00.svg">
|
||||
<defs
|
||||
id="defs4097" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="3.959798"
|
||||
inkscape:cx="66.875008"
|
||||
inkscape:cy="72.027342"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1003"
|
||||
inkscape:window-x="-9"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4102" />
|
||||
<metadata
|
||||
id="metadata4100">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<rect
|
||||
width="26.25"
|
||||
height="26.25"
|
||||
x="0.140625"
|
||||
y="0.140625"
|
||||
id="rect2987"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28125;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 3.6121917,3.944092 v 9.643682"
|
||||
id="path3724-8"
|
||||
style="fill:none;stroke:#a00a0a;stroke-width:1.125;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,3.7895896 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,3.7895896 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-8"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,3.7895896 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-5"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,13.26562 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-0"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,13.26562 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-6"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,13.26562 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-4"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,22.74165 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-62"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,22.74165 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-58"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,22.74165 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-628"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
</svg>
|
Before Width: | Height: | Size: 6.7 KiB |
@@ -1,112 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="26.53125mm"
|
||||
height="26.53125mm"
|
||||
viewBox="0 0 26.53125 26.53125"
|
||||
version="1.1"
|
||||
id="svg4102"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
sodipodi:docname="vertical_12.svg">
|
||||
<defs
|
||||
id="defs4097" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.8"
|
||||
inkscape:cx="114.38062"
|
||||
inkscape:cy="68.130493"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1003"
|
||||
inkscape:window-x="-9"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4102" />
|
||||
<metadata
|
||||
id="metadata4100">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<rect
|
||||
width="26.25"
|
||||
height="26.25"
|
||||
x="0.140625"
|
||||
y="0.140625"
|
||||
id="rect2987"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28125;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 22.935124,13.076632 v 9.643682"
|
||||
id="path3724-8"
|
||||
style="fill:none;stroke:#a00a0a;stroke-width:1.125;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,3.7895896 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,3.7895896 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-8"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,3.7895896 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-5"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,13.26562 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-0"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,13.26562 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-6"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,13.26562 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-4"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,22.74165 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-62"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,22.74165 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-58"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,22.74165 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-628"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
</svg>
|
Before Width: | Height: | Size: 6.7 KiB |
@@ -1,222 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="26.53125mm"
|
||||
height="26.53125mm"
|
||||
viewBox="0 0 26.53125 26.53125"
|
||||
version="1.1"
|
||||
id="svg4102"
|
||||
inkscape:version="0.92.4 (5da689c313, 2019-01-14)"
|
||||
sodipodi:docname="vertical_idx.svg">
|
||||
<defs
|
||||
id="defs4097" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="2.8"
|
||||
inkscape:cx="160.48283"
|
||||
inkscape:cy="65.287899"
|
||||
inkscape:document-units="mm"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1003"
|
||||
inkscape:window-x="-9"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg4102"
|
||||
showguides="false"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:snap-to-guides="true">
|
||||
<sodipodi:guide
|
||||
position="0.88588171,16.335659"
|
||||
orientation="1,0"
|
||||
id="guide4184"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="10.547898,15.981306"
|
||||
orientation="1,0"
|
||||
id="guide4186"
|
||||
inkscape:locked="false" />
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid4254" />
|
||||
<sodipodi:guide
|
||||
position="20.198103,15.733259"
|
||||
orientation="1,0"
|
||||
id="guide4256"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="15.969494,19.158669"
|
||||
orientation="0,1"
|
||||
id="guide4336"
|
||||
inkscape:locked="false" />
|
||||
<sodipodi:guide
|
||||
position="8.669829,9.543899"
|
||||
orientation="0,1"
|
||||
id="guide4338"
|
||||
inkscape:locked="false" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4100">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<rect
|
||||
width="26.25"
|
||||
height="26.25"
|
||||
x="0.140625"
|
||||
y="0.140625"
|
||||
id="rect2987"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.28125;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,3.7895896 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,3.7895896 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-8"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,3.7895896 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-5"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,13.26562 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-0"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,13.26562 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-6"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,13.26562 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-4"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 4.8865036,22.74165 a 1.2712229,1.2712229 0 1 1 -2.54244,0 1.2712229,1.2712229 0 1 1 2.54244,0 z"
|
||||
id="path2989-62"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 14.536844,22.74165 a 1.271225,1.271225 0 1 1 -2.54245,0 1.271225,1.271225 0 1 1 2.54245,0 z"
|
||||
id="path2989-58"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<path
|
||||
inkscape:connector-curvature="0"
|
||||
d="m 24.18717,22.74165 a 1.271223,1.271223 0 1 1 -2.54244,0 1.271223,1.271223 0 1 1 2.54244,0 z"
|
||||
id="path2989-628"
|
||||
style="color:#808080;display:inline;overflow:visible;visibility:visible;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.2700544;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate" />
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="0.90272093"
|
||||
y="9.031786"
|
||||
id="text4162"
|
||||
transform="scale(0.95386243,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160"
|
||||
x="0.90272093"
|
||||
y="9.031786"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 0,0 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="11.097216"
|
||||
y="9.0313826"
|
||||
id="text4162-1"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-2"
|
||||
x="11.097216"
|
||||
y="9.0313826"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 0,1 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="0.93034029"
|
||||
y="18.217352"
|
||||
id="text4162-5"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-1"
|
||||
x="0.93034029"
|
||||
y="18.217352"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 1,0 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="21.200579"
|
||||
y="9.0508375"
|
||||
id="text4162-0"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-5"
|
||||
x="21.200579"
|
||||
y="9.0508375"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 0,2 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="11.048577"
|
||||
y="18.167271"
|
||||
id="text4162-4"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-9"
|
||||
x="11.048577"
|
||||
y="18.167271"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 1,1 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.02851319px;line-height:1;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.25237608"
|
||||
x="21.25436"
|
||||
y="18.302471"
|
||||
id="text4162-54"
|
||||
transform="scale(0.95386244,1.0483692)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4160-8"
|
||||
x="21.25436"
|
||||
y="18.302471"
|
||||
style="font-size:2.69201183px;line-height:1;stroke-width:0.25237608"> 1,2 </tspan></text>
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-style:normal;font-weight:normal;font-size:3.17499995px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
|
||||
x="1.6370258"
|
||||
y="8.5239649"
|
||||
id="text4244"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan4242"
|
||||
x="1.6370258"
|
||||
y="11.333096"
|
||||
style="stroke-width:0.26458332"></tspan></text>
|
||||
</svg>
|
Before Width: | Height: | Size: 11 KiB |
@@ -1,13 +0,0 @@
|
||||
# Task
|
||||
|
||||
Write a program which reads in an integer a larger than `1000` and outputs its last three digits. For example, if `a=14325`, the output should be `3 2 5`.
|
||||
|
||||
_Hint_: You need to use integer division and modulo operators.
|
||||
|
||||
# Input
|
||||
|
||||
An integer larger than `1000`.
|
||||
|
||||
# Output
|
||||
|
||||
Last three digits separated by spaces.
|
@@ -1,22 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
|
||||
int a;
|
||||
std::cin >> a; // get input of for a
|
||||
|
||||
if (a >= 1000) { // check if input is greater than 1000
|
||||
int b = a % 10; // get last digit
|
||||
a /= 10;
|
||||
int c = a % 10; // get second digit
|
||||
a /= 10;
|
||||
int d = a % 10; // get first digit
|
||||
|
||||
std::cout << d << " " << c << " "
|
||||
<< b; // output first, second, and last digit
|
||||
} else { // if input not greater than 1000 return 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
# Task
|
||||
|
||||
Let `a`, `b`, `c`, and `d` be variables of type `int`.
|
||||
|
||||
- Which of the following character sequences are valid expressions in the sense that they are accepted by a C++ Compiler? Explain your answer.
|
||||
|
||||
1. a = b = 5
|
||||
1. 1 = a
|
||||
1. ++a + b++
|
||||
1. a + b = c + d
|
||||
1. a = 2 b
|
||||
|
||||
Assume that all the variables have been defined and correctly initialized and that all expressions are completely independent from each other.
|
||||
|
||||
- For each of the expressions that you have identified as valid, decide whether the entire expression is an `lvalue` or an `rvalue`, and explain your decision.
|
||||
|
||||
- Determine the values of the expressions that you have identified as valid and explain how these values are obtained.
|
52
Informatik_I/Exercise_1/Task_1/README.org
Normal file
@@ -0,0 +1,52 @@
|
||||
#+TITLE: Task 1: Expressions
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
Let =a=, =b=, =c=, and =d= be variables of type =int=.
|
||||
|
||||
- Which of the following character sequences are valid expressions in the sense that they are accepted by a C++ Compiler? Explain your answer.
|
||||
|
||||
1. a = b = 5
|
||||
1. 1 = a
|
||||
1. ++a + b++
|
||||
1. a + b = c + d
|
||||
1. a = 2 b
|
||||
|
||||
Assume that all the variables have been defined and correctly initialized and that all expressions are completely independent from each other.
|
||||
|
||||
- For each of the expressions that you have identified as valid, decide whether the entire expression is an =lvalue= or an =rvalue=, and explain your decision.
|
||||
|
||||
- Determine the values of the expressions that you have identified as valid and explain how these values are obtained.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src md
|
||||
# Task 1
|
||||
|
||||
---
|
||||
|
||||
### Expression 1: `a = b = 5`
|
||||
|
||||
The expression is valid and will be accepted by the CPP compiler. It will result with the l-values `a = 5` and `b = 5`. This is due to the fact the the `=` opperation is read from right to left so `b = 5` will run first and `a = b` afterwards.
|
||||
|
||||
### Expression 2: `1 = a`
|
||||
|
||||
The expression is invalid.
|
||||
|
||||
### Expression 3: `++a + b++`
|
||||
|
||||
The expression is valid and will be accepted by the CPP compiler. It will result in a r-value since the result is not assigned to a variable.
|
||||
|
||||
### Expression 4: `a + b = c + d`
|
||||
|
||||
The expression is invalid.
|
||||
|
||||
### Expression 5: `a = 2 b`
|
||||
|
||||
The expression is valid and will be accepted by the CPP compiler. It will result with the l-value `a = 2 b`. This is valid since a l-value can be a r-value.
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,23 +0,0 @@
|
||||
# Task 1
|
||||
|
||||
---
|
||||
|
||||
### Expression 1: `a = b = 5`
|
||||
|
||||
The expression is valid and will be accepted by the CPP compiler. It will result with the l-values `a = 5` and `b = 5`. This is due to the fact the the `=` opperation is read from right to left so `b = 5` will run first and `a = b` afterwards.
|
||||
|
||||
### Expression 2: `1 = a`
|
||||
|
||||
The expression is invalid.
|
||||
|
||||
### Expression 3: `++a + b++`
|
||||
|
||||
The expression is valid and will be accepted by the CPP compiler. It will result in a r-value since the result is not assigned to a variable.
|
||||
|
||||
### Expression 4: `a + b = c + d`
|
||||
|
||||
The expression is invalid.
|
||||
|
||||
### Expression 5: `a = 2 b`
|
||||
|
||||
The expression is valid and will be accepted by the CPP compiler. It will result with the l-value `a = 2 b`. This is valid since a l-value can be a r-value.
|
@@ -1,24 +0,0 @@
|
||||
# Task
|
||||
|
||||
_This task is a text-based task but mostly automatically checked. You are required to write your answers into submission.txt by replacing the question marks with the correct solution. Please, do not change the line formating._
|
||||
|
||||
_You can check whether your solution is correct by clicking on the test button._
|
||||
|
||||
Numbers can be provided in various formats in C++. Literals prefixed with `0b` indicate binary encoding. Assume unsigned arithmetics with sufficient numbers of bits, i.e. no overflows. Convert the following binary numbers into decimal numbers (1-4) and decimal numbers to binary (5-8):
|
||||
|
||||
```txt
|
||||
# Lines starting with # are comments. Spaces is ignored.
|
||||
# Lines starting with a whitespace before # will not be a comment.
|
||||
|
||||
# Convert to decimal:
|
||||
0b1 = ?
|
||||
0b10 = ?
|
||||
0b000001 = ?
|
||||
0b101010 = ?
|
||||
|
||||
# Convert to binary:
|
||||
7 = ?
|
||||
11 = ?
|
||||
28 = ?
|
||||
1024 = ?
|
||||
```
|
50
Informatik_I/Exercise_1/Task_2/README.org
Normal file
@@ -0,0 +1,50 @@
|
||||
#+TITLE: Task 2: Representation of Integers
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
/This task is a text-based task but mostly automatically checked. You are required to write your answers into =submission.txt= by replacing the question marks with the correct solution. Please, do not change the line formating./
|
||||
|
||||
/You can check whether your solution is correct by clicking on the test button./
|
||||
|
||||
Numbers can be provided in various formats in C++. Literals prefixed with =0b= indicate binary encoding. Assume unsigned arithmetics with sufficient numbers of bits, i.e. no overflows. Convert the following binary numbers into decimal numbers (1-4) and decimal numbers to binary (5-8):
|
||||
|
||||
#+begin_src txt
|
||||
# Lines starting with # are comments. Spaces is ignored.
|
||||
# Lines starting with a whitespace before # will not be a comment.
|
||||
|
||||
# Convert to decimal:
|
||||
0b1 = ?
|
||||
0b10 = ?
|
||||
0b000001 = ?
|
||||
0b101010 = ?
|
||||
|
||||
# Convert to binary:
|
||||
7 = ?
|
||||
11 = ?
|
||||
28 = ?
|
||||
1024 = ?
|
||||
#+end_src
|
||||
|
||||
* Solutions
|
||||
|
||||
#+begin_src txt
|
||||
# Lines starting with # are comments. Spaces are ignored.
|
||||
# Lines starting with a whitespace before # will not be a comment.
|
||||
|
||||
# Convert to decimal:
|
||||
0b1 = 1
|
||||
0b10 = 2
|
||||
0b000001 = 1
|
||||
0b101010 = 42
|
||||
|
||||
# Convert to binary:
|
||||
7 = 0b111
|
||||
11 = 0b1011
|
||||
28 = 0b11100
|
||||
1024 = 0b10000000000
|
||||
#+end_src
|
||||
|
||||
—----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,14 +0,0 @@
|
||||
# Lines starting with # are comments. Spaces are ignored.
|
||||
# Lines starting with a whitespace before # will not be a comment.
|
||||
|
||||
# Convert to decimal:
|
||||
0b1 = 1
|
||||
0b10 = 2
|
||||
0b000001 = 1
|
||||
0b101010 = 42
|
||||
|
||||
# Convert to binary:
|
||||
7 = 0b111
|
||||
11 = 0b1011
|
||||
28 = 0b11100
|
||||
1024 = 0b10000000000
|
@@ -1,18 +0,0 @@
|
||||
# Task
|
||||
|
||||
Write a program resistance.cpp that computes the equivalent resistance of the following wiring:
|
||||
|
||||

|
||||
|
||||
We assume that $R_1$, $R_2$, $R_3$, and $R_4$ have an integer valued resistance. After input of the four values, the program should output the result arithmetically rounded to the nearest integer.
|
||||
|
||||
**Remark:** In order to facilitate the task, you may want to:
|
||||
|
||||
- Conceptually divide the task into sub tasks. For example, start with computation of serial resistors $R_{12}$ and $R_{34}$.
|
||||
- Solve the task first naively using default rounding and then think about how to accomplish arithmetic rounding. Recall that $\text{round}(x) = [x + 0.5] \text{ }\forall \text{ } x \in \mathbb{R}$, i.e., a real number can be rounded arithmetically by adding $0.5$ to it and then rounding down. For example, $\text{round}(8,6) = [8.6 + 0.5] = [9.1] = 9$.
|
||||
|
||||
You can find formulas for computing the total resistance in this [Wikipedia article](https://en.wikipedia.org/wiki/Resistor#Series_and_parallel_resistors).
|
||||
|
||||
**Important:** using anything other than int (e.g., floating point numbers, long, or double long) is forbidden.
|
||||
|
||||
**Important:** using if-else and any other branches is forbidden.
|
55
Informatik_I/Exercise_1/Task_3/README.org
Normal file
@@ -0,0 +1,55 @@
|
||||
#+TITLE: Task 3: Equivalent Resistance
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
Write a program resistance.cpp that computes the equivalent resistance of the following wiring:
|
||||
|
||||
[[./resistance.png]]
|
||||
|
||||
We assume that \(R_1\), \(R_2\), \(R_3\), and \(R_4\) have an integer valued resistance. After input of the four values, the program should output the result arithmetically rounded to the nearest integer.
|
||||
|
||||
*Remark:* In order to facilitate the task, you may want to:
|
||||
|
||||
- Conceptually divide the task into sub tasks. For example, start with computation of serial resistors \(R_{12}\) and \(R_{34}\).
|
||||
- Solve the task first naively using default rounding and then think about how to accomplish arithmetic rounding. Recall that \(\text{round}(x) = [x + 0.5] \text{ }\forall \text{ } x \in \mathbb{R}\), i.e., a real number can be rounded arithmetically by adding \(0.5\) to it and then rounding down. For example, \(\text{round}(8,6) = [8.6 + 0.5] = [9.1] = 9\).
|
||||
|
||||
You can find formulas for computing the total resistance in this [[https://en.wikipedia.org/wiki/Resistor#Series_and_parallel_resistors][Wikipedia article]].
|
||||
|
||||
*Important:* using anything other than =int= (e.g., floating point numbers, =long=, or =double long=) is forbidden.
|
||||
|
||||
*Important:* using =if-else= and any other branches is forbidden.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int r1;
|
||||
int r2;
|
||||
int r3;
|
||||
int r4;
|
||||
int res;
|
||||
|
||||
std::cin >> r1;
|
||||
std::cin >> r2;
|
||||
std::cin >> r3;
|
||||
std::cin >> r4;
|
||||
|
||||
int r12 = r1 + r2;
|
||||
int r34 = r3 + r4;
|
||||
|
||||
res = (r12 * r34 + ((r12 + r34) / 2)) /
|
||||
(r12 + r34); // By adding the average of r12 and r34, the result is
|
||||
// increased enough to get the correct rounded number
|
||||
|
||||
std::cout << res;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-—---
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,25 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int r1;
|
||||
int r2;
|
||||
int r3;
|
||||
int r4;
|
||||
int res;
|
||||
|
||||
std::cin >> r1;
|
||||
std::cin >> r2;
|
||||
std::cin >> r3;
|
||||
std::cin >> r4;
|
||||
|
||||
int r12 = r1 + r2;
|
||||
int r34 = r3 + r4;
|
||||
|
||||
res = (r12 * r34 + ((r12 + r34) / 2)) /
|
||||
(r12 + r34); // By adding the average of r12 and r34, the result is
|
||||
// increased enough to get the correct rounded number
|
||||
|
||||
std::cout << res;
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
# Task 1
|
||||
|
||||
This task is a text based task. You do not need to write any program/C++ file: the answer should be written in solutions.txt according to the indicated format. Lines that start with "#" are interpreted as comments. You can run the autograder to check correctness.
|
||||
|
||||
## Task
|
||||
|
||||
Which of the following expressions evaluate to `true`, which to `false`?
|
||||
|
||||
1. `3 >= 3`
|
||||
1. `true || false && false`
|
||||
1. `(true || false) && false`
|
||||
1. `3 > (1 < true)`
|
||||
1. `8 > 4 > 2 > 1`
|
||||
1. `2 < a < 4` (a is a variable of type int)
|
37
Informatik_I/Exercise_2/task_1/README.org
Normal file
@@ -0,0 +1,37 @@
|
||||
#+TITLE: Task 1: Expression Evaluation
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
|
||||
This task is a text based task. You do not need to write any program/C++ file: the answer should be written in solutions.txt according to the indicated format. Lines that start with "#" are interpreted as comments. You can run the autograder to check correctness.
|
||||
|
||||
* Task
|
||||
|
||||
Which of the following expressions evaluate to =true=, which to =false=?
|
||||
|
||||
1. =3 >= 3=
|
||||
1. =true || false && false=
|
||||
1. =(true || false) && false=
|
||||
1. =3 > (1 < true)=
|
||||
1. =8 > 4 > 2 > 1=
|
||||
1. =2 < a < 4= (a is a variable of type int)
|
||||
|
||||
* Solutions
|
||||
|
||||
#+begin_src txt
|
||||
# Lines starting with # are comments. Spaces are ignored.
|
||||
|
||||
# Replace the question marks, indicating which of the following expression evaluate to true, which to false.
|
||||
|
||||
|
||||
1. 3 >= 3 == true
|
||||
|
||||
2. true || false && false == true
|
||||
|
||||
3. (true || false) && false == false
|
||||
|
||||
4. 3 > (1 < true) == true
|
||||
|
||||
5. 8 > 4 > 2 > 1 == false
|
||||
|
||||
6. 2 < a < 4 == true
|
||||
#+end_src
|
@@ -1,17 +0,0 @@
|
||||
# Lines starting with # are comments. Spaces are ignored.
|
||||
|
||||
# Replace the question marks, indicating which of the following expression evaluate to true, which to false.
|
||||
|
||||
|
||||
1. 3 >= 3 == true
|
||||
|
||||
2. true || false && false == true
|
||||
|
||||
3. (true || false) && false == false
|
||||
|
||||
4. 3 > (1 < true) == true
|
||||
|
||||
5. 8 > 4 > 2 > 1 == false
|
||||
|
||||
6. 2 < a < 4 == true
|
||||
|
@@ -1,25 +0,0 @@
|
||||
# Task
|
||||
|
||||
Translate the following natural language expressions to `C++` expressions. Assume that all the variables are non-negative integers or boolean (of value `true` or `false`).
|
||||
|
||||
_For this task you need to write the solutions in the `solutions.cpp` file, by filling the various functions that have been defined for each subtasks._
|
||||
|
||||
**Example:** $a$ is greater than $3$ and smaller than $5$. $\Longrightarrow$ Solution:
|
||||
|
||||
```cpp
|
||||
return a > 3 && a < 5;
|
||||
```
|
||||
|
||||
_Note:_ Do not confuse the bitwise logical operators (e.g., `&`) with their binary logical counterparts (`&&`). The semantics are slightly different — bitwise operators do not exhibit short circuit evaluation.
|
||||
|
||||
1. $a$ greater than $b$ and the difference between $a$ and $b$ is smaller than $15$.
|
||||
1. $a$ is an even natural number greater than $a$.
|
||||
1. $a$ is at most $5$ times greater than $b$ (but can also be smaller than $b$) and at least $5$ times greater than $c$.
|
||||
1. Either $a$ and $b$ are both false or $c$ is true, but not both.
|
||||
1. $a$ is false and $b$ is zero.
|
||||
|
||||
## Input
|
||||
|
||||
The program expects the task number as the first input followed by the parameters to the chosen task. For example, `3 5 1 1` selects task `3` with `a = 5`, `b = 1`, and `c = 1`.
|
||||
|
||||
Note that boolean parameters for tasks 4 and 5 are entered as true and false. For example `4 true false true` would run task `4` with `a = true`, `b = false`, and `c = true`.
|
86
Informatik_I/Exercise_2/task_2/README.org
Normal file
@@ -0,0 +1,86 @@
|
||||
#+TITLE: Task 2: From Natural Language to C++
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
Translate the following natural language expressions to =C++= expressions. Assume that all the variables are non-negative integers or boolean (of value =true= or =false=).
|
||||
|
||||
/For this task you need to write the solutions in the =solutions.cpp= file, by filling the various functions that have been defined for each subtasks./
|
||||
|
||||
*Example:* \(a\) is greater than \(3\) and smaller than \(5\). \(\Longrightarrow\) *Solution:*
|
||||
|
||||
#+begin_src cpp
|
||||
return a > 3 && a < 5;
|
||||
#+end_src
|
||||
|
||||
/Note:/ Do not confuse the bitwise logical operators (e.g., =&=) with their binary logical counterparts (=&&=). The semantics are slightly different — bitwise operators do not exhibit short circuit evaluation.
|
||||
|
||||
1. \(a\) greater than \(b\) and the difference between \(a\) and \(b\) is smaller than \(15\).
|
||||
1. \(a\) is an even natural number greater than \(a\).
|
||||
1. \(a\) is at most \(5\) times greater than \(b\) (but can also be smaller than \(b\)) and at least \(5\) times greater than \(c\).
|
||||
1. Either \(a\) and \(b\) are both false or \(c\) is true, but not both.
|
||||
1. \(a\) is false and \(b\) is zero.
|
||||
|
||||
** Input
|
||||
|
||||
The program expects the task number as the first input followed by the parameters to the chosen task. For example, =3 5 1 1= selects task =3= with =a = 5=, =b = 1=, and =c = 1=.
|
||||
|
||||
Note that boolean parameters for tasks 4 and 5 are entered as true and false. For example =4 true false true= would run task =4= with =a = true=, =b = false=, and =c = true=.
|
||||
|
||||
* Solutions
|
||||
|
||||
#+begin_src cpp
|
||||
#include "solutions.h"
|
||||
|
||||
// Fill out each function with the appropriate expression
|
||||
|
||||
bool task1(int a, int b) {
|
||||
// a greater than b and the difference between a and b is smaller than 15.
|
||||
if (a > b && (a - b) < 15) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task2(int a) {
|
||||
// a is an even natural number greater than 3.
|
||||
if (a > 3 && a % 2 == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task3(int a, int b, int c) {
|
||||
// a is at most 5 times greater than b (but can also be smaller than b)
|
||||
// and at least 5 times greater than c.
|
||||
if (a <= 5 * b && a >= 5 * c) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task4(bool a, bool b, bool c) {
|
||||
// Either a and b are both false or c is true, but not both.
|
||||
if ((a == false && b == false) != (c == true)) {
|
||||
return true; // Replace with your solution
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task5(bool a, int b) {
|
||||
// a is false and b is zero.
|
||||
if (a == false && b == false) {
|
||||
return true;
|
||||
} else {
|
||||
return false; // Replace with your solution
|
||||
}
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,49 +0,0 @@
|
||||
#include "solutions.h"
|
||||
|
||||
// Fill out each function with the appropriate expression
|
||||
|
||||
bool task1(int a, int b) {
|
||||
// a greater than b and the difference between a and b is smaller than 15.
|
||||
if (a > b && (a - b) < 15) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task2(int a) {
|
||||
// a is an even natural number greater than 3.
|
||||
if (a > 3 && a % 2 == 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task3(int a, int b, int c) {
|
||||
// a is at most 5 times greater than b (but can also be smaller than b)
|
||||
// and at least 5 times greater than c.
|
||||
if (a <= 5 * b && a >= 5 * c) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task4(bool a, bool b, bool c) {
|
||||
// Either a and b are both false or c is true, but not both.
|
||||
if ((a == false && b == false) != (c == true)) {
|
||||
return true; // Replace with your solution
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool task5(bool a, int b) {
|
||||
// a is false and b is zero.
|
||||
if (a == false && b == false) {
|
||||
return true;
|
||||
} else {
|
||||
return false; // Replace with your solution
|
||||
}
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
# Task
|
||||
|
||||
_Fibonacci numbers_ are the integers in the following sequence: $0, 1, 1, 2, 3, 5, 8, 13, 21, ...$. Each number is the sum of the two previous numbers.
|
||||
|
||||
_Fibonacci primes_ are Fibonacci numbers that are also prime numbers. Write a program that asks the user for an integer $m$ and then computes and prints all Fibonacci primes between $0$ and $m$ (including). Print each number on a new line.
|
||||
|
||||
Finally, on a new line print the total number of Fibonacci primes found.
|
||||
|
||||
## Example
|
||||
|
||||
If your program is asked to print the Fibonacci primes between $0$ and $14$ the output should look something like this:
|
||||
|
||||
```
|
||||
2
|
||||
3
|
||||
5
|
||||
13
|
||||
Found 4 Fibonacci primes
|
||||
```
|
||||
|
||||
**Important:** using anything other than `int` (e.g., `unsigned int`, floating point numbers, `long`, or double `long`) is forbidden.
|
@@ -1,3 +1,30 @@
|
||||
#+TITLE: Task 3a: Fibonacci primes
|
||||
|
||||
* Task
|
||||
|
||||
/Fibonacci numbers/ are the integers in the following sequence: \(0, 1, 1, 2, 3, 5, 8, 13, 21, ...\). Each number is the sum of the two previous numbers.
|
||||
|
||||
/Fibonacci primes/ are Fibonacci numbers that are also prime numbers. Write a program that asks the user for an integer \(m\) and then computes and prints all Fibonacci primes between \(0\) and \(m\) (including). Print each number on a new line.
|
||||
|
||||
Finally, on a new line print the total number of Fibonacci primes found.
|
||||
|
||||
** Example
|
||||
|
||||
If your program is asked to print the Fibonacci primes between $0$ and $14$ the output should look something like this:
|
||||
|
||||
#+begin_src shell
|
||||
2
|
||||
3
|
||||
5
|
||||
13
|
||||
Found 4 Fibonacci primes
|
||||
#+end_src
|
||||
|
||||
*Important:* using anything other than =int= (e.g., =unsigned int=, floating point numbers, =long=, or double =long=) is forbidden.
|
||||
|
||||
* Solutions
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
@@ -45,3 +72,8 @@ int main() {
|
||||
// End message
|
||||
std::cout << count << "\n";
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-—---
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,58 +0,0 @@
|
||||
# Mistakes
|
||||
|
||||
- The variable `j` goes into overflow which is not allowed!
|
||||
|
||||
# Fibonacci overflow check
|
||||
|
||||
## Background
|
||||
|
||||
_Fibonacci numbers_ are the integers in the following sequence: $0, 1, 1, 2, 3, 5, 8, 13, 21, ...$, where each number is the sum of the two previous numbers.
|
||||
|
||||
## Task
|
||||
|
||||
Fibonacci numbers grow fast, and can thus easily exceed the value range of 32-bit `int`. Think of a general way how you can check if the result of an addition would exceed the range of a 32-bit `int` (i.e. overflow) **without actually performing the addition causing the overflow.**
|
||||
|
||||
Remember that we consider **signed integers.** Because only half of the numbers are positive, this leaves us with 31 bits to store the actual positive number value.
|
||||
|
||||
Write a program that asks the user for an integer $n$ and then prints the first $n$ Fibonacci numbers, each number on a new line. Use an `int` (we assume 32 bits, including the sign) to represent the current Fibonacci number. **Most importantly:** exit the print loop as soon as you detect that an overflow _would occur._
|
||||
|
||||
Finally, again on a new line, output the count $c$ of Fibonacci numbers previously printed, and the initial input $n$ from the user, in the format: `c of n`.
|
||||
|
||||
### Example:
|
||||
|
||||
Let's (wrongly!) assume that $5$ cannot be represented using a 32 bit int. This means that $3$ is the largest 32-bit Fibonacci number. If your program is asked to print the first $4$ Fibonacci numbers the output should look as follows:
|
||||
|
||||
```
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
Printed 4 of 4 Fibonacci numbers
|
||||
```
|
||||
|
||||
If you instead ask it to print the first 100 Fibonacci numbers the output should look as follows:
|
||||
|
||||
```
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
Printed 5 of 100 Fibonacci numbers
|
||||
```
|
||||
|
||||
**Important:** using anything other than `int` (e.g., `unsigned int`, floating point numbers, `long`, or double `long`) is forbidden.
|
||||
|
||||
**Restrictions:**
|
||||
|
||||
- The program **must not** rely on the knowledge of its final result. In particular, it is not allowed to hard-code
|
||||
- the largest 32-bits Fibonacci number, or
|
||||
- the number of digits that it has, or
|
||||
- the total number of Fibonacci numbers representable with a 32-bit int
|
||||
- Most importantly: do not perform additions that cause an overflow on 32 bit
|
||||
|
||||
**Note:** It is straightfoward to compute the largest (signed) integer representable with 32 bits. You are also explicitly allowed to hard-code this value in your program.
|
||||
|
||||
---
|
||||
|
||||
**Warning:** The autograder does not catch if an addition causes an overflow or if you do anything that's disallowed in the "Restrictions" section above, but you will receive 0 points when your TA corrects and catches this.
|
94
Informatik_I/Exercise_2/task_3b/README.org
Normal file
@@ -0,0 +1,94 @@
|
||||
#+TITLE: Task 3b: Fibonacci overflow check
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Background
|
||||
|
||||
/Fibonacci numbers/ are the integers in the following sequence: \(0, 1, 1, 2, 3, 5, 8, 13, 21, ...\), where each number is the sum of the two previous numbers.
|
||||
|
||||
* Task
|
||||
|
||||
Fibonacci numbers grow fast, and can thus easily exceed the value range of 32-bit =int=. Think of a general way how you can check if the result of an addition would exceed the range of a 32-bit =int= (i.e. overflow) *without actually performing the addition causing the overflow.*
|
||||
|
||||
Remember that we consider *signed integers.* Because only half of the numbers are positive, this leaves us with 31 bits to store the actual positive number value.
|
||||
|
||||
Write a program that asks the user for an integer \(n\) and then prints the first $n$ Fibonacci numbers, each number on a new line. Use an =int= (we assume 32 bits, including the sign) to represent the current Fibonacci number. *Most importantly:* exit the print loop as soon as you detect that an overflow /would occur./
|
||||
|
||||
Finally, again on a new line, output the count \(c\) of Fibonacci numbers previously printed, and the initial input \(n\) from the user, in the format: =c of n=.
|
||||
|
||||
** Example:
|
||||
|
||||
Let's (wrongly!) assume that \(5\) cannot be represented using a 32 bit =int=. This means that \(3\) is the largest 32-bit Fibonacci number. If your program is asked to print the first \(4\) Fibonacci numbers the output should look as follows:
|
||||
|
||||
#+begin_src shell
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
Printed 4 of 4 Fibonacci numbers
|
||||
#+end_src
|
||||
|
||||
If you instead ask it to print the first 100 Fibonacci numbers the output should look as follows:
|
||||
|
||||
#+begin_src shell
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
Printed 5 of 100 Fibonacci numbers
|
||||
#+end_src
|
||||
|
||||
*Important:* using anything other than =int= (e.g., =unsigned int=, floating point numbers, =long=, or double =long=) is forbidden.
|
||||
|
||||
*Restrictions:*
|
||||
|
||||
- The program **must not** rely on the knowledge of its final result. In particular, it is not allowed to hard-code
|
||||
- the largest 32-bits Fibonacci number, or
|
||||
- the number of digits that it has, or
|
||||
- the total number of Fibonacci numbers representable with a 32-bit int
|
||||
- Most importantly: do not perform additions that cause an overflow on 32 bit
|
||||
|
||||
*Note:* It is straightfoward to compute the largest (signed) integer representable with 32 bits. You are also explicitly allowed to hard-code this value in your program.
|
||||
|
||||
-----
|
||||
|
||||
*Warning:* The autograder does not catch if an addition causes an overflow or if you do anything that's disallowed in the "Restrictions" section above, but you will receive 0 points when your TA corrects and catches this.
|
||||
|
||||
* Mistakes
|
||||
|
||||
- The variable =j= goes into overflow which is not allowed!
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int a = 0; // First Fibonacci number
|
||||
int b = 1; // Second Fibonacci number
|
||||
int j = 0; // New Fibonacci number
|
||||
int c = 0; // Number of Fibonacci numbers
|
||||
int max = 2147483647;
|
||||
int n; // Input integer
|
||||
|
||||
std::cin >> n;
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
|
||||
if (max - a < b) { // Check if the new Fibonacci number goes into overflow
|
||||
break;
|
||||
} else { // otherwise, calculate next Fibonacci number
|
||||
std::cout << j << "\n";
|
||||
a = b;
|
||||
b = j;
|
||||
j = a + b;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
std::cout << c << " of " << n; // End Message
|
||||
}
|
||||
#+end_src
|
||||
|
||||
—----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,26 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int a = 0; // First Fibonacci number
|
||||
int b = 1; // Second Fibonacci number
|
||||
int j = 0; // New Fibonacci number
|
||||
int c = 0; // Number of Fibonacci numbers
|
||||
int max = 2147483647;
|
||||
int n; // Input integer
|
||||
|
||||
std::cin >> n;
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
|
||||
if (max - a < b) { // Check if the new Fibonacci number goes into overflow
|
||||
break;
|
||||
} else { // otherwise, calculate next Fibonacci number
|
||||
std::cout << j << "\n";
|
||||
a = b;
|
||||
b = j;
|
||||
j = a + b;
|
||||
++c;
|
||||
}
|
||||
}
|
||||
std::cout << c << " of " << n; // End Message
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
## Task
|
||||
|
||||
Write a program that inputs a non-negative integer `n` (but store it as `int`) and outputs the binary digits of `n` in the _correct_ order (i.e., starting with the most significant bit). Do not output the leading zeros or the sign.
|
||||
|
||||
**Hint:** In order to find the largest integer $k$ such that $2^k \leq x$, you can utilize that $k$ is the smallest integer such that $2^k > \frac{x}{2}$. This observation is particularly useful to avoid an overflow for the expression $2^k$ when searching for the most significant bit to represent $x$.
|
||||
|
||||
**Restrictions:**
|
||||
|
||||
- Libraries: only the iostream standard library header is allowed; using arrays, string or cmath is not permitted.
|
||||
- Operators: you may not use bitshift operators to manipulate the numbers.
|
||||
|
||||
---
|
||||
|
||||
**Warning:** The autograder does not catch if you do anything that's disallowed in the "Restrictions" section above, but you will receive 0 points when your TA corrects and catches this.
|
54
Informatik_I/Exercise_2/task_4/README.org
Normal file
@@ -0,0 +1,54 @@
|
||||
#+TITLE: Task 4: From decimal to binary representation
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
Write a program that inputs a non-negative integer =n= (but store it as =int=) and outputs the binary digits of =n= in the /correct/ order (i.e., starting with the most significant bit). Do not output the leading zeros or the sign.
|
||||
|
||||
*Hint:* In order to find the largest integer \(k\) such that \(2^k \leq x\), you can utilize that \(k\) is the smallest integer such that \(2^k > \frac{x}{2}\). This observation is particularly useful to avoid an overflow for the expression \(2^k\) when searching for the most significant bit to represent \(x\).
|
||||
|
||||
*Restrictions:*
|
||||
|
||||
- Libraries: only the iostream standard library header is allowed; using arrays, string or cmath is not permitted.
|
||||
- Operators: you may not use bitshift operators to manipulate the numbers.
|
||||
|
||||
-----
|
||||
|
||||
*Warning:* The autograder does not catch if you do anything that's disallowed in the "Restrictions" section above, but you will receive 0 points when your TA corrects and catches this.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int i = 0; // Input integer
|
||||
int d = 0; // Input Number
|
||||
int a = 0; // Part of binary number
|
||||
int b = 0; // Number to divide
|
||||
int count = 0;
|
||||
|
||||
std::cin >> i;
|
||||
d = i;
|
||||
b = i;
|
||||
|
||||
if (i < 0) {
|
||||
return 0;
|
||||
} else if (i == 0) {
|
||||
std::cout << 0;
|
||||
} else {
|
||||
while (d != 0) {
|
||||
d = d / 2;
|
||||
++count;
|
||||
}
|
||||
for (; count > 0; --count) {
|
||||
for (int j = count; j > 1; --j) {
|
||||
b = b / 2;
|
||||
}
|
||||
a = b % 2;
|
||||
std::cout << a;
|
||||
b = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
#+end_src
|
@@ -1,32 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int i = 0; // Input integer
|
||||
int d = 0; // Input Number
|
||||
int a = 0; // Part of binary number
|
||||
int b = 0; // Number to divide
|
||||
int count = 0;
|
||||
|
||||
std::cin >> i;
|
||||
d = i;
|
||||
b = i;
|
||||
|
||||
if (i < 0) {
|
||||
return 0;
|
||||
} else if (i == 0) {
|
||||
std::cout << 0;
|
||||
} else {
|
||||
while (d != 0) {
|
||||
d = d / 2;
|
||||
++count;
|
||||
}
|
||||
for (; count > 0; --count) {
|
||||
for (int j = count; j > 1; --j) {
|
||||
b = b / 2;
|
||||
}
|
||||
a = b % 2;
|
||||
std::cout << a;
|
||||
b = i;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
_This task is a mixed text/programming task. You need to update the content of loop.cpp according to the instruction provided in the file. For the code part, please check the autograder output._
|
||||
|
||||
# Task
|
||||
|
||||
Considering the snippet
|
||||
|
||||
```cpp
|
||||
int n;
|
||||
std::cin >> n;
|
||||
int f = 1;
|
||||
if (n > 0) {
|
||||
do {
|
||||
f = f * n;
|
||||
--n;
|
||||
} while (n > 0);
|
||||
}
|
||||
std::cout << f << std::endl;
|
||||
```
|
||||
|
||||
1. Describe what it computes.
|
||||
1. Decide which of the other two kind of loops would fit better than the one it is currently using, and describe why.
|
||||
1. Rewrite the snippet into the loop you specified in (2). This part is autograded.
|
||||
|
||||
**Important**: The use of goto statements is prohibited.
|
@@ -1,3 +1,34 @@
|
||||
#+TITLE: Task 1: Loop mix-up: Snippet 1
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
/This task is a mixed text/programming task. You need to update the content of loop.cpp according to the instruction provided in the file. For the code part, please check the autograder output./
|
||||
|
||||
* Task
|
||||
|
||||
Considering the snippet
|
||||
|
||||
#+begin_src cpp
|
||||
int n;
|
||||
std::cin >> n;
|
||||
int f = 1;
|
||||
if (n > 0) {
|
||||
do {
|
||||
f = f * n;
|
||||
--n;
|
||||
} while (n > 0);
|
||||
}
|
||||
std::cout << f << std::endl;
|
||||
#+end_src
|
||||
|
||||
1. Describe what it computes.
|
||||
1. Decide which of the other two kind of loops would fit better than the one it is currently using, and describe why.
|
||||
1. Rewrite the snippet into the loop you specified in (2). This part is autograded.
|
||||
|
||||
*Important*: The use of goto statements is prohibited.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include "loop.h"
|
||||
#include <iostream>
|
||||
|
||||
@@ -41,3 +72,8 @@ void loop() {
|
||||
|
||||
std::cout << f << std::endl;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-—---
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,23 +0,0 @@
|
||||
_This task is a mixed text/programming task. You need to update the content of loop.cpp according to the instruction provided in the file. For the code part, please check the autograder output._
|
||||
|
||||
# Task
|
||||
|
||||
Considering the snippet
|
||||
|
||||
```cpp
|
||||
for (;;) {
|
||||
int i1, i2;
|
||||
std::cin >> i1 >> i2;
|
||||
std::cout << i1 + i2 << "\n";
|
||||
int again;
|
||||
std::cout << "Again? (0/1)\n";
|
||||
std::cin >> again;
|
||||
if (again == 0) break;
|
||||
}
|
||||
```
|
||||
|
||||
1. Describe what it computes.
|
||||
|
||||
1. Decide which of the other two kind of loops would fit better than the one it is currently using, and describe why.
|
||||
|
||||
1. Rewrite the snippet into the loop you specified in (2). This part is autograded. Note: print the control message "Again? (0/1)" using the same format used in the snippet.
|
@@ -1,3 +1,33 @@
|
||||
#+TITLE: Task 2: Loop mix-up: Snippet 2
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
/This task is a mixed text/programming task. You need to update the content of loop.cpp according to the instruction provided in the file. For the code part, please check the autograder output./
|
||||
|
||||
* Task
|
||||
|
||||
Considering the snippet
|
||||
|
||||
#+begin_src cpp
|
||||
for (;;) {
|
||||
int i1, i2;
|
||||
std::cin >> i1 >> i2;
|
||||
std::cout << i1 + i2 << "\n";
|
||||
int again;
|
||||
std::cout << "Again? (0/1)\n";
|
||||
std::cin >> again;
|
||||
if (again == 0) break;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
1. Describe what it computes.
|
||||
|
||||
1. Decide which of the other two kind of loops would fit better than the one it is currently using, and describe why.
|
||||
|
||||
1. Rewrite the snippet into the loop you specified in (2). This part is autograded. Note: print the control message "Again? (0/1)" using the same format used in the snippet.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include "loop.h"
|
||||
#include <iostream>
|
||||
|
||||
@@ -46,3 +76,8 @@ void loop() {
|
||||
std::cin >> again;
|
||||
}
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,27 +0,0 @@
|
||||
_This task is a mixed text/programming task. You need to update the content of loop.cpp according to the instructions provided in the file. For the code part, please check the autograder output._
|
||||
|
||||
# Task
|
||||
|
||||
Consider the following program:
|
||||
|
||||
```cpp
|
||||
int n;
|
||||
std::cin >> n;
|
||||
|
||||
int x = 1;
|
||||
if (n > 0) {
|
||||
bool e = true;
|
||||
do {
|
||||
if (--n == 0) {
|
||||
e = false;
|
||||
}
|
||||
x *= 2;
|
||||
} while (e);
|
||||
}
|
||||
std::cout << x << std::endl;
|
||||
```
|
||||
|
||||
1. Describe the output of the program as a function of its input n.
|
||||
1. For which values of `n` do you expect a correct output `x`? Explain why.
|
||||
1. Show that this program terminates for all values of `n` found in (2). Hint: Make an argument based on the following idea. First prove that the program terminates for the `n=0` and `n=1`. Then show that it terminates for any other `n` knowing that it terminates for `n-1`. This creates a domino effect where the fact that the program terminates for `n=1` proves that the program must also terminate for `n=2`, and this in turn proves that the program must terminate for `n=3`, and so on. This technique is called "proof by induction".
|
||||
1. Provide a more elegant implementation of this function using another type of loop. This part is autograded.
|
92
Informatik_I/Exercise_3/Task_3/README.org
Normal file
@@ -0,0 +1,92 @@
|
||||
#+TITLE: Task 3: Loop Analysis
|
||||
|
||||
/This task is a mixed text/programming task. You need to update the content of loop.cpp according to the instructions provided in the file. For the code part, please check the autograder output./
|
||||
|
||||
* Task
|
||||
|
||||
Consider the following program:
|
||||
|
||||
#+begin_src cpp
|
||||
int n;
|
||||
std::cin >> n;
|
||||
|
||||
int x = 1;
|
||||
if (n > 0) {
|
||||
bool e = true;
|
||||
do {
|
||||
if (--n == 0) {
|
||||
e = false;
|
||||
}
|
||||
x *= 2;
|
||||
} while (e);
|
||||
}
|
||||
std::cout << x << std::endl;
|
||||
#+end_src
|
||||
|
||||
1. Describe the output of the program as a function of its input \(n\).
|
||||
1. For which values of \(n\) do you expect a correct output \(x\)? Explain why.
|
||||
1. Show that this program terminates for all values of \(n\) found in (2). Hint: Make an argument based on the following idea. First prove that the program terminates for the \(n=0\) and \(n=1\). Then show that it terminates for any other \(n\) knowing that it terminates for \(n-1\). This creates a domino effect where the fact that the program terminates for \(n=1\) proves that the program must also terminate for \(n=2\), and this in turn proves that the program must terminate for \(n=3\), and so on. This technique is called "proof by induction".
|
||||
1. Provide a more elegant implementation of this function using another type of loop. This part is autograded.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include "loop.h"
|
||||
#include <iostream>
|
||||
|
||||
// Fill out the file with the required answers
|
||||
|
||||
/*
|
||||
|
||||
Subtask 1: Describe the output of the program as a function of its input n.
|
||||
|
||||
This code snippte computes the powers of 2 with a positive exponential. The
|
||||
exponential is the input by the user.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Subtask 2: For which values of n do you expect a correct output x? Explain
|
||||
why.
|
||||
|
||||
For a exponential between 0 and 30. Anything below zero would result in the
|
||||
wrong answer (1) and anything above 30 would result in an overflow. In
|
||||
addition, if we imporved the code to calculate the powers of 2 with negative
|
||||
exponents, it would not work since the result of the powers of 2 with negative
|
||||
exponents are variables of type float or double and the code snippet is
|
||||
working with integers.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Subtask 3: Show that this program terminates for all values of n found in (2).
|
||||
|
||||
If the input is 31, the output is -2147483648.
|
||||
If the input is -1, the output is 1.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Subtask 4: Provide a more elegant implementation of this function using
|
||||
another type of loop.
|
||||
*/
|
||||
|
||||
void loop() {
|
||||
|
||||
int n;
|
||||
std::cin >> n;
|
||||
|
||||
int x = 1;
|
||||
|
||||
for (; n > 0; --n)
|
||||
x *= 2;
|
||||
|
||||
std::cout << x << std::endl;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,54 +0,0 @@
|
||||
#include "loop.h"
|
||||
#include <iostream>
|
||||
|
||||
// Fill out the file with the required answers
|
||||
|
||||
/*
|
||||
|
||||
Subtask 1: Describe the output of the program as a function of its input n.
|
||||
|
||||
This code snippte computes the powers of 2 with a positive exponential. The
|
||||
exponential is the input by the user.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Subtask 2: For which values of n do you expect a correct output x? Explain
|
||||
why.
|
||||
|
||||
For a exponential between 0 and 30. Anything below zero would result in the
|
||||
wrong answer (1) and anything above 30 would result in an overflow. In
|
||||
addition, if we imporved the code to calculate the powers of 2 with negative
|
||||
exponents, it would not work since the result of the powers of 2 with negative
|
||||
exponents are variables of type float or double and the code snippet is
|
||||
working with integers.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Subtask 3: Show that this program terminates for all values of n found in (2).
|
||||
|
||||
If the input is 31, the output is -2147483648.
|
||||
If the input is -1, the output is 1.
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
Subtask 4: Provide a more elegant implementation of this function using
|
||||
another type of loop.
|
||||
*/
|
||||
|
||||
void loop() {
|
||||
|
||||
int n;
|
||||
std::cin >> n;
|
||||
|
||||
int x = 1;
|
||||
|
||||
for (; n > 0; --n)
|
||||
x *= 2;
|
||||
|
||||
std::cout << x << std::endl;
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
# Task
|
||||
|
||||
The number $\pi$ can be defined through various infinite sums. The accuracy increases with the number of terms. Considering the following sum, that we call sum 1:
|
||||
|
||||
$$\frac{\pi}{4} = \sum_{j=0}^{m-1} \frac{(-1)^j}{2j + 1} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + ...$$
|
||||
|
||||
Note that $m$ is the number of the terms in the sum. For example, $m=2$ refers to the sum of the terms $1$ (for $j=0$) and $-\frac{1}{3}$ (for $j=1$). This examples yields a value of $4 \cdot (1-\frac{1}{3})$ for $\pi$.
|
||||
|
||||
Write a program that computes and outputs an approximation of Pi, based on sum 1. The input for your program is the number of **terms** $m$ of sum 1 that should be considered in the calculation. The output is the approximation of $\pi$.
|
||||
|
||||
## Input
|
||||
|
||||
A number $m \geq 1$.
|
||||
|
||||
## Output
|
||||
|
||||
The approximation of $\pi$ given by $4 \sum_{j=0}^{m-1} \frac{(-1)^j}{2j + 1}$, rounded to 6 significant digits. Note that 6 significant digits is the default precision of C++ for printing floating-point values. Use a variable of type double to calculate the sum. Note that that $x^0$ is 1 (if $x \neq 0$).
|
||||
|
||||
**Important**: the use of functions from the math library (e.g., pow) is prohibited.
|
61
Informatik_I/Exercise_3/Task_4a/README.org
Normal file
@@ -0,0 +1,61 @@
|
||||
#+TITLE: Task 4a: Approximation of Pi: Sum 1
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
The number \(\pi\) can be defined through various infinite sums. The accuracy increases with the number of terms. Considering the following sum, that we call sum 1:
|
||||
|
||||
$$\frac{\pi}{4} = \sum_{j=0}^{m-1} \frac{(-1)^j}{2j + 1} = 1 - \frac{1}{3} + \frac{1}{5} - \frac{1}{7} + ...$$
|
||||
|
||||
Note that \(m\) is the number of the terms in the sum. For example, \(m=2\)$ refers to the sum of the terms \(1\) (for \(j=0\)) and \(-\frac{1}{3}\) (for \(j=1\)). This examples yields a value of \(4 \cdot (1-\frac{1}{3})\) for \(\pi\).
|
||||
|
||||
Write a program that computes and outputs an approximation of Pi, based on sum 1. The input for your program is the number of **terms** $m$ of sum 1 that should be considered in the calculation. The output is the approximation of \(\pi\).
|
||||
|
||||
** Input
|
||||
|
||||
A number \(m \geq 1\).
|
||||
|
||||
** Output
|
||||
|
||||
The approximation of \(\pi\) given by \(4 \sum_{j=0}^{m-1} \frac{(-1)^j}{2j + 1}\), rounded to 6 significant digits. Note that 6 significant digits is the default precision of C++ for printing floating-point values. Use a variable of type double to calculate the sum. Note that \(x^0\) is 1 (if \(x \neq 0\)).
|
||||
|
||||
**Important**: the use of functions from the math library (e.g., pow) is prohibited.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
double power(double n, double e) { // Self defined function for exponent
|
||||
int res = 1;
|
||||
for (; e > 0; --e) {
|
||||
res *= n;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int main() {
|
||||
double m; // User Input
|
||||
double pi = 0; // Pi
|
||||
float res; // Outputed result with 6 significant digits
|
||||
|
||||
std::cin >> m;
|
||||
|
||||
if (m < 1) { // Check if Input is greater than 1.
|
||||
return 0;
|
||||
} else {
|
||||
for (int i = 0; i < m; ++i) {
|
||||
pi = pi + 4 * ((power(-1, i)) / ((2 * i) + 1)); // calculate Pi
|
||||
}
|
||||
|
||||
res = (float)(pi); // round to 6 significant digits
|
||||
std::cout << res;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,30 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
double power(double n, double e) { // Self defined function for exponent
|
||||
int res = 1;
|
||||
for (; e > 0; --e) {
|
||||
res *= n;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int main() {
|
||||
double m; // User Input
|
||||
double pi = 0; // Pi
|
||||
float res; // Outputed result with 6 significant digits
|
||||
|
||||
std::cin >> m;
|
||||
|
||||
if (m < 1) { // Check if Input is greater than 1.
|
||||
return 0;
|
||||
} else {
|
||||
for (int i = 0; i < m; ++i) {
|
||||
pi = pi + 4 * ((power(-1, i)) / ((2 * i) + 1)); // calculate Pi
|
||||
}
|
||||
|
||||
res = (float)(pi); // round to 6 significant digits
|
||||
std::cout << res;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
# Task
|
||||
|
||||
The number $\pi$ can be defined through various infinite sums. The accuracy increases with the number of terms. Considering the following sum, which we call sum 2:
|
||||
|
||||
$$\frac{\pi}{2} = 1 + \sum_{j = 1}^{m - 1} \frac{\prod_{i=1}^j i}{\prod_{i=1}^j (2i + 1)} = 1 + \frac{1}{3} + \frac{1 \cdot 2}{3 \cdot 5} + \frac{1 \cdot 2 \cdot 3}{3 \cdot 5 \cdot 7} + ...$$
|
||||
|
||||
Write a program that computes and outputs an approximation of Pi, based on sum 2. The input for your program is the number of **terms** $m$ (including 1) to be included in the calculation to be done. The output is the approximation of $\pi$.
|
||||
|
||||
**Optional**: After you have solved this and the previous task, think about which formula gives a more precise approximation of
|
||||
, sum 1 or sum 2 ? What are the drawbacks? Write your thoughts in a comment below the code.
|
||||
|
||||
## Input
|
||||
|
||||
A natural number $m$ ($m \geq 1$).
|
||||
|
||||
## Output
|
||||
|
||||
The approximation of $\pi$ given by $m$ terms, rounded to 6 significant digits. Note that 6 significant digits is the default precision of C++ for printing floating-point values. Use a double variable to store the sum.
|
||||
|
||||
**Important**: the use of functions from the math library (e.g., pow) is prohibited.
|
66
Informatik_I/Exercise_3/Task_4b/README.org
Normal file
@@ -0,0 +1,66 @@
|
||||
#+TITLE: Task 4b: Approximation of Pi: Sum 2
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
The number \(\pi\) can be defined through various infinite sums. The accuracy increases with the number of terms. Considering the following sum, which we call sum 2:
|
||||
|
||||
$$\frac{\pi}{2} = 1 + \sum_{j = 1}^{m - 1} \frac{\prod_{i=1}^j i}{\prod_{i=1}^j (2i + 1)} = 1 + \frac{1}{3} + \frac{1 \cdot 2}{3 \cdot 5} + \frac{1 \cdot 2 \cdot 3}{3 \cdot 5 \cdot 7} + ...$$
|
||||
|
||||
Write a program that computes and outputs an approximation of Pi, based on sum 2. The input for your program is the number of **terms** $m$ (including 1) to be included in the calculation to be done. The output is the approximation of \(\pi\).
|
||||
|
||||
**Optional**: After you have solved this and the previous task, think about which formula gives a more precise approximation of \(\pi\), sum 1 or sum 2 ? What are the drawbacks? Write your thoughts in a comment below the code.
|
||||
|
||||
* Input
|
||||
|
||||
A natural number \(m\) (\(m \geq 1\)).
|
||||
|
||||
* Output
|
||||
|
||||
The approximation of $\pi$ given by $m$ terms, rounded to 6 significant digits. Note that 6 significant digits is the default precision of C++ for printing floating-point values. Use a double variable to store the sum.
|
||||
|
||||
**Important**: the use of functions from the math library (e.g., =pow=) is prohibited.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
double productsumnum(double n) {
|
||||
double res = 1;
|
||||
for (int j = 1; j <= n; ++j) {
|
||||
res *= j;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
double productsumden(double n) {
|
||||
double res = 1;
|
||||
for (int j = 1; j <= n; ++j) {
|
||||
res *= (2 * j + 1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
double m; // User Input
|
||||
double pi = 2; // Pi
|
||||
float res; // Outputed result with 6 significant digits
|
||||
|
||||
std::cin >> m;
|
||||
|
||||
for (int i = 1; i < m; ++i) {
|
||||
pi += (2 * (productsumnum(i) / productsumden(i)));
|
||||
}
|
||||
|
||||
res = (float)(pi);
|
||||
std::cout << res;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,35 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
double productsumnum(double n) {
|
||||
double res = 1;
|
||||
for (int j = 1; j <= n; ++j) {
|
||||
res *= j;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
double productsumden(double n) {
|
||||
double res = 1;
|
||||
for (int j = 1; j <= n; ++j) {
|
||||
res *= (2 * j + 1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
double m; // User Input
|
||||
double pi = 2; // Pi
|
||||
float res; // Outputed result with 6 significant digits
|
||||
|
||||
std::cin >> m;
|
||||
|
||||
for (int i = 1; i < m; ++i) {
|
||||
pi += (2 * (productsumnum(i) / productsumden(i)));
|
||||
}
|
||||
|
||||
res = (float)(pi);
|
||||
std::cout << res;
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,19 +0,0 @@
|
||||
_This task is a text-based task but automatically checked. You are required to write your answers into solutions.txt by replacing the question marks with the correct solution. Please, do not change the structure of solutions.txt and be consistent with its syntax (comment-lines start with #)_
|
||||
|
||||
# Task
|
||||
|
||||
We examine the normalized binary representation of floating point numbers in the normalized floating point system $F*(2,4,-3,3)$.
|
||||
|
||||
1. Convert the following decimal numbers to the normalized binary representation. For each number, choose the appropriate exponent $e$ and round to the nearest value if you cannot represent the exact value. If the exact number falls exactly midway between two bracketing finite floating point representations, round to the number with an even least significant bit.
|
||||
|
||||
- $0.75_{10}$
|
||||
- $3.1416_{10}$
|
||||
- $2.718_{10}$
|
||||
- $7_{10}$
|
||||
- $0.11_{10}$
|
||||
|
||||
1. For each number of (2), convert the binary representation back to their decimal form, and determine the absolute rounding error of the conversion.
|
||||
|
||||
1. Calculate $2.718_{10} + 3.1416_{10} + 0.11_{10}$ in the binary representation. What do you observe?
|
||||
|
||||
**Note**: The question of how to round floating point numbers is non-trivial. The IEEE standard lists 5 different modes of rounding of which we only mentioned the most common one at the beginning of this exercise. If you are interested to learn more, you can access the most recent standard through the ETH network.
|
90
Informatik_I/Exercise_4/Task_1/README.org
Normal file
@@ -0,0 +1,90 @@
|
||||
#+TITLE: Task 1: Floating-Point Number Representation
|
||||
|
||||
/This task is a text-based task but automatically checked. You are required to write your answers into solutions.txt by replacing the question marks with the correct solution. Please, do not change the structure of solutions.txt and be consistent with its syntax (comment-lines start with #)/
|
||||
|
||||
* Task
|
||||
|
||||
We examine the normalized binary representation of floating point numbers in the normalized floating point system $F*(2,4,-3,3)$.
|
||||
|
||||
1. Convert the following decimal numbers to the normalized binary representation. For each number, choose the appropriate exponent $e$ and round to the nearest value if you cannot represent the exact value. If the exact number falls exactly midway between two bracketing finite floating point representations, round to the number with an even least significant bit.
|
||||
|
||||
- \(0.75_{10}\)
|
||||
- \(3.1416_{10}\)
|
||||
- \(2.718_{10}\)
|
||||
- \(7_{10}\)
|
||||
- \(0.11_{10}\)
|
||||
|
||||
1. For each number of (2), convert the binary representation back to their decimal form, and determine the absolute rounding error of the conversion.
|
||||
|
||||
1. Calculate \(2.718_{10} + 3.1416_{10} + 0.11_{10}\) in the binary representation. What do you observe?
|
||||
|
||||
**Note**: The question of how to round floating point numbers is non-trivial. The IEEE standard lists 5 different modes of rounding of which we only mentioned the most common one at the beginning of this exercise. If you are interested to learn more, you can access the most recent standard through the ETH network.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src shell
|
||||
# NOTE: Lines starting with # are comments. Spaces are ignored.
|
||||
# Replace the question marks, with your answer, following the instructions
|
||||
# provided for each subtask.
|
||||
|
||||
|
||||
######################## Subtask 1 ############################
|
||||
# Subtask 1a: convert 0.75.
|
||||
# In the given system, this is equal to "1.100 * 2^-1". The solution
|
||||
# is written as "1.100*2^-1", without spaces and without quotation marks.
|
||||
|
||||
1a) 1.100*2^-1
|
||||
|
||||
# Subtask 1b: convert 3.1416
|
||||
|
||||
1b) 1.101*2^1
|
||||
|
||||
# Subtask 1c: convert 2.718
|
||||
|
||||
1c) 1.011*2^1
|
||||
|
||||
# Subtask 1d: convert 7
|
||||
|
||||
1d) 1.110*2^2
|
||||
|
||||
# Subtask 1e: convert 0.11
|
||||
|
||||
1e) 1.000*2^-3
|
||||
|
||||
######################## Subtask 2 ############################
|
||||
# Convert the first number of previous Sub-Task back to decimal form.
|
||||
# For each number you are required to write the decimal number and the
|
||||
# conversion error (each on a different line).
|
||||
# For your convenience, the first number is already converted.
|
||||
|
||||
|
||||
2a-decimal) 0.75
|
||||
2a-error) 0
|
||||
|
||||
2b-decimal) 3.25
|
||||
2b-error) 0.1084
|
||||
|
||||
2c-decimal) 2.75
|
||||
2c-error) 0.032
|
||||
|
||||
2d-decimal) 7
|
||||
2d-error) 0
|
||||
|
||||
2e-decimal) 0.125
|
||||
2e-error) 0.015
|
||||
|
||||
######################## Subtask 3 ############################
|
||||
|
||||
# Calculate the result of the addition and indicate the result in the
|
||||
# same format as in the first sub-task ("siginificand*2^exp", without
|
||||
# quotation marks). Then, write your observation as a comment right below.
|
||||
|
||||
3) 1.100*2^2
|
||||
|
||||
# Write your observations here
|
||||
# The Decimal System cannot be represented accurately by the binary system. There will always be an error. When adding the number converted from the decimal to the binary sytem, the error becomes greater.
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,60 +0,0 @@
|
||||
# NOTE: Lines starting with # are comments. Spaces are ignored.
|
||||
# Replace the question marks, with your answer, following the instructions
|
||||
# provided for each subtask.
|
||||
|
||||
|
||||
######################## Subtask 1 ############################
|
||||
# Subtask 1a: convert 0.75.
|
||||
# In the given system, this is equal to "1.100 * 2^-1". The solution
|
||||
# is written as "1.100*2^-1", without spaces and without quotation marks.
|
||||
|
||||
1a) 1.100*2^-1
|
||||
|
||||
# Subtask 1b: convert 3.1416
|
||||
|
||||
1b) 1.101*2^1
|
||||
|
||||
# Subtask 1c: convert 2.718
|
||||
|
||||
1c) 1.011*2^1
|
||||
|
||||
# Subtask 1d: convert 7
|
||||
|
||||
1d) 1.110*2^2
|
||||
|
||||
# Subtask 1e: convert 0.11
|
||||
|
||||
1e) 1.000*2^-3
|
||||
|
||||
######################## Subtask 2 ############################
|
||||
# Convert the first number of previous Sub-Task back to decimal form.
|
||||
# For each number you are required to write the decimal number and the
|
||||
# conversion error (each on a different line).
|
||||
# For your convenience, the first number is already converted.
|
||||
|
||||
|
||||
2a-decimal) 0.75
|
||||
2a-error) 0
|
||||
|
||||
2b-decimal) 3.25
|
||||
2b-error) 0.1084
|
||||
|
||||
2c-decimal) 2.75
|
||||
2c-error) 0.032
|
||||
|
||||
2d-decimal) 7
|
||||
2d-error) 0
|
||||
|
||||
2e-decimal) 0.125
|
||||
2e-error) 0.015
|
||||
|
||||
######################## Subtask 3 ############################
|
||||
|
||||
# Calculate the result of the addition and indicate the result in the
|
||||
# same format as in the first sub-task ("siginificand*2^exp", without
|
||||
# quotation marks). Then, write your observation as a comment right below.
|
||||
|
||||
3) 1.100*2^2
|
||||
|
||||
# Write your observations here
|
||||
# The Decimal System cannot be represented accurately by the binary system. There will always be an error. When adding the number converted from the decimal to the binary sytem, the error becomes greater.
|
@@ -1,17 +0,0 @@
|
||||
# Task
|
||||
|
||||
Consider a parabola $(\m{P})$ defined as $y = g(x)$, with $g(x) = 0.9 \cdot x^2 + 1.3 \cdot x - 0.7$.
|
||||
|
||||
Write a program that determines if a point $(x,y)$ lies on parabola $(\m{P})$ or not. The input is provided by two decimal numbers in the sequence $x,y$. The program must output `yes`, if the point lies on the parabola, otherwise `no`. Use datatype `double` for all variables and numbers used in the calculation of $g(x)$.
|
||||
|
||||
You will notice that a straight forward approach (comparing for equality) does not work, i.e., for some points that clearly should be on parabola $g$ such an approach returns result `no`.
|
||||
|
||||
_Hint_: Look at the difference between the exact values of the function and the values that your program calculates. Change the program so that it works properly for all points the submission system uses as test input without hard-coding the points. Expect an epsilon within the range $\[ 10^{-6}, 10^{-3}]\$. Experiment yourself to find the epsilon required to pass the test cases.
|
||||
|
||||
**Note**: Output only with `std::cout << "no" << std::endl;` or `std::cout << "yes" << std::endl;`, as the autograder will only accept output that exactly matches `yes\n` or `no\n`. For all other messages, use `std::cerr` as in:
|
||||
|
||||
```cpp
|
||||
std::cerr << "This is a test message\n"
|
||||
```
|
||||
|
||||
Those will be ignored by the autograder.
|
54
Informatik_I/Exercise_4/Task_2/README.org
Normal file
@@ -0,0 +1,54 @@
|
||||
#+TITLE: Task 2: Point on Parabola?
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
Consider a parabola \((\m{P})\) defined as \(y = g(x)\), with \(g(x) = 0.9 \cdot x^2 + 1.3 \cdot x - 0.7\).
|
||||
|
||||
Write a program that determines if a point \((x,y)\) lies on parabola \((\m{P})\) or not. The input is provided by two decimal numbers in the sequence \(x,y\). The program must output =yes=, if the point lies on the parabola, otherwise =no=. Use datatype =double= for all variables and numbers used in the calculation of \(g(x)\).
|
||||
|
||||
You will notice that a straight forward approach (comparing for equality) does not work, i.e., for some points that clearly should be on parabola $g$ such an approach returns result =no=.
|
||||
|
||||
/Hint/: Look at the difference between the exact values of the function and the values that your program calculates. Change the program so that it works properly for all points the submission system uses as test input without hard-coding the points. Expect an epsilon within the range \([ 10^{-6}, 10^{-3}]\)$. Experiment yourself to find the epsilon required to pass the test cases.
|
||||
|
||||
**Note**: Output only with =std::cout << "no" << std::endl;= or =std::cout << "yes" << std::endl;=, as the autograder will only accept output that exactly matches =yes\n= or =no\n=. For all other messages, use =std::cerr= as in:
|
||||
|
||||
#+begin_src cpp
|
||||
std::cerr << "This is a test message\n"
|
||||
#+end_src
|
||||
|
||||
Those will be ignored by the autograder.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
|
||||
double x = 0; // x inputed by user
|
||||
double yin = 0; // y inputed by user
|
||||
double ycon = 0; // y control
|
||||
double emax = 0.0001;
|
||||
double emin = -0.0001;
|
||||
|
||||
std::cin >> x;
|
||||
std::cin >> yin;
|
||||
|
||||
ycon = 0.9 * x * x + 1.3 * x - 0.7;
|
||||
|
||||
std::cerr << ycon;
|
||||
std::cerr << yin - ycon;
|
||||
|
||||
if (yin == ycon || (yin - ycon <= emax && yin - ycon >= emin))
|
||||
std::cout << "yes";
|
||||
else
|
||||
std::cout << "no";
|
||||
|
||||
return 0;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,25 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
|
||||
double x = 0; // x inputed by user
|
||||
double yin = 0; // y inputed by user
|
||||
double ycon = 0; // y control
|
||||
double emax = 0.0001;
|
||||
double emin = -0.0001;
|
||||
|
||||
std::cin >> x;
|
||||
std::cin >> yin;
|
||||
|
||||
ycon = 0.9 * x * x + 1.3 * x - 0.7;
|
||||
|
||||
std::cerr << ycon;
|
||||
std::cerr << yin - ycon;
|
||||
|
||||
if (yin == ycon || (yin - ycon <= emax && yin - ycon >= emin))
|
||||
std::cout << "yes";
|
||||
else
|
||||
std::cout << "no";
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
# Task
|
||||
|
||||
Implement the following rounding function that rounds a 64-bit floating point number (type `double`) to the nearest 32-bit integer (type `int`). You may assume that the type `double` complies with the IEEE standard 754. The function is only required to work correctly if the nearest integer is in the value range of the type `int`, otherwise, the return value of the function is undefined.
|
||||
|
||||
**Note: Usage of library rounding functions (standard or others) is not allowed.**
|
||||
|
||||
```cpp
|
||||
// PRE: x is roundable to a number in the value range of type @int@
|
||||
// POST: return value is the integer nearest to x, or the one further
|
||||
// away from 0 if x lies right in between two integers.
|
||||
int round_number(double x);
|
||||
```
|
||||
|
||||
Write your solution in `rounding.h`.
|
||||
|
||||
_Hint_: In `C++`, when you convert a `float` or `double` to an `int`, the fractional part gets cut off (truncated). Think about how you can use the truncated number to solve the exercise.
|
41
Informatik_I/Exercise_4/Task_3/README.org
Normal file
@@ -0,0 +1,41 @@
|
||||
#+TITLE: Task 3: Rounding
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
Implement the following rounding function that rounds a 64-bit floating point number (type =double=) to the nearest 32-bit integer (type =int=). You may assume that the type =double= complies with the IEEE standard 754. The function is only required to work correctly if the nearest integer is in the value range of the type =int=, otherwise, the return value of the function is undefined.
|
||||
|
||||
**Note: Usage of library rounding functions (standard or others) is not allowed.**
|
||||
|
||||
#+begin_src cpp
|
||||
// PRE: x is roundable to a number in the value range of type @int@
|
||||
// POST: return value is the integer nearest to x, or the one further
|
||||
// away from 0 if x lies right in between two integers.
|
||||
int round_number(double x);
|
||||
#+end_src
|
||||
|
||||
Write your solution in =rounding.h=.
|
||||
|
||||
/Hint/: In =C++=, when you convert a =float= or =double= to an =int=, the fractional part gets cut off (truncated). Think about how you can use the truncated number to solve the exercise.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#pragma once
|
||||
|
||||
// PRE: x is roundable to a number in the value range of type int
|
||||
// POST: return value is the integer nearest to x, or the one further
|
||||
// away from 0 if x lies right in between two integers.
|
||||
int round_number(double x) {
|
||||
int res;
|
||||
if (x < 0)
|
||||
res = x - 0.5;
|
||||
else
|
||||
res = x + 0.5;
|
||||
return res;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// PRE: x is roundable to a number in the value range of type int
|
||||
// POST: return value is the integer nearest to x, or the one further
|
||||
// away from 0 if x lies right in between two integers.
|
||||
int round_number(double x) {
|
||||
int res;
|
||||
if (x < 0)
|
||||
res = x - 0.5;
|
||||
else
|
||||
res = x + 0.5;
|
||||
return res;
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
# Task
|
||||
|
||||
Write a program that performs the binary expansion for a given decimal input number $x$, where $0 \leq x < 2$. Use the algorithm presented in the lecture. The program must output the first $16$ digits of the number in the format: $b_0, b_1, b_2, ... , b_15$.
|
||||
|
||||
_Important_ Always print all $16$ digits, even the trailing zeros. Do not normalize or round the number.
|
||||
|
||||
You can structure your program into functions to avoid code repetition. Do not forget to annotate functions with pre- and post conditions.
|
47
Informatik_I/Exercise_4/Task_4/README.org
Normal file
@@ -0,0 +1,47 @@
|
||||
#+TITLE: Task 4: Binary Expansion
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
Write a program that performs the binary expansion for a given decimal input number \(x\), where \(0 \leq x < 2\). Use the algorithm presented in the lecture. The program must output the first \(16\) digits of the number in the format: \(b_0, b_1, b_2, ... , b_15\).
|
||||
|
||||
/Important/ Always print all \(16\) digits, even the trailing zeros. Do not normalize or round the number.
|
||||
|
||||
You can structure your program into functions to avoid code repetition. Do not forget to annotate functions with pre- and post conditions.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
|
||||
float i;
|
||||
int n;
|
||||
float d;
|
||||
|
||||
std::cin >> i;
|
||||
|
||||
if (i < 0 || i > 2)
|
||||
return 0;
|
||||
else {
|
||||
n = i;
|
||||
d = i - n;
|
||||
|
||||
std::cout << n << ".";
|
||||
|
||||
n = d;
|
||||
d = 2 * (d - n);
|
||||
|
||||
for (int j = 1; j <= 15; ++j) {
|
||||
n = d;
|
||||
d = 2 * (d - n);
|
||||
std::cout << n;
|
||||
}
|
||||
}
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,28 +0,0 @@
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
|
||||
float i;
|
||||
int n;
|
||||
float d;
|
||||
|
||||
std::cin >> i;
|
||||
|
||||
if (i < 0 || i > 2)
|
||||
return 0;
|
||||
else {
|
||||
n = i;
|
||||
d = i - n;
|
||||
|
||||
std::cout << n << ".";
|
||||
|
||||
n = d;
|
||||
d = 2 * (d - n);
|
||||
|
||||
for (int j = 1; j <= 15; ++j) {
|
||||
n = d;
|
||||
d = 2 * (d - n);
|
||||
std::cout << n;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,50 +0,0 @@
|
||||
# Task
|
||||
|
||||
A perpetual calendar can be used to determine the weekday (Monday, ..., Sunday) of any given date. You may for example know that the Berlin wall came down on November 9, 1989, but what was the weekday? It was a Thursday. Or what is the weekday of the 1000th anniversary of the Swiss confederation, to be celebrated on August 1, 2291? It will be a Saturday. The task of this exercise is to write a program that outputs the weekday of a given input date.
|
||||
|
||||
Your program will read the date from the input. The input is given as three integer values in the following order: Day, month, year. First the program must validate the input. Pay attention to special cases of February (leap years!) also, the date must be greater or equal to the reference date. If a date is invalid output invalid date. If the date is valid, calculate the weekday of this day. This can be done by calculating how many days lie between the date in question and a reference date whose weekday is known. As reference date use Monday, 1st January 1900. Finally, output the weekday as one word in English.
|
||||
|
||||
**Approach**: The goal of this exercise is to learn the usage of functions. For that, we split the program into the following sub tasks given as function declarations. Your task is to **implement the provided functions** in the calendar.cpp file, so that they perform the action that is specified in their post condition.
|
||||
|
||||
**Important: There is a well-known mathematical function to calculate the weekday of a date. Using this function is an incorrect solution as it defeats the purpose of this exercise.**
|
||||
|
||||
```cpp
|
||||
// PRE: a year greater or equal than 1900
|
||||
// POST: returns whether that year was a leap year
|
||||
bool is_leap_year(int year);
|
||||
|
||||
// PRE: a year greater or equal than 1900
|
||||
// POST: returns the number of days in that year
|
||||
int count_days_in_year(int year);
|
||||
|
||||
// PRE: a month between 1 and 12 and a year greater or equal than 1900
|
||||
// POST: returns the number of days in the month of that year
|
||||
int count_days_in_month(int month, int year);
|
||||
|
||||
// PRE: n/a
|
||||
// POST: returns whether the given values represent a valid date
|
||||
bool is_valid_date(int day, int month, int year);
|
||||
|
||||
// PRE: the given values represent a valid date
|
||||
// POST: returns the number of days between January 1, 1900 and this date (excluding this date)
|
||||
int count_days(int day, int month, int year);
|
||||
|
||||
// PRE: the given values represent a (potentially invalid) date
|
||||
// POST: prints the weekday if the date is valid or "invalid date" otherwise.
|
||||
// Everything must be printed in lowercase.
|
||||
void print_weekday(int day, int month, int year);
|
||||
```
|
||||
|
||||
To complete the task, you have to provide the definition of the aforementioned functions.
|
||||
|
||||
The `calendar.cpp` file contains skeletons of the functions to be implemented. The `main.cpp` file contains testing functions and the main function. In the main function, a menu is printed to select the function that has to be tested.
|
||||
|
||||
**Important** the main is not editable. Required functions must be implemented in `calendar.cpp`.
|
||||
|
||||
**Additional notes:**
|
||||
|
||||
1. For function arguments that do **not** fulfill the precondition, the behavior is undefined.
|
||||
|
||||
1. There are a few opportunities here to use switch statements. Use them if they result in better readable code.
|
||||
|
||||
1. A leap year is defined as follows: It is an integer multiple of 4, except for years evenly divisible by 100, which are not leap years unless evenly divisible by 400. (Source: [Wikipedia](https://en.wikipedia.org/wiki/Leap_year))
|
152
Informatik_I/Exercise_5/Task_1/README.org
Normal file
@@ -0,0 +1,152 @@
|
||||
#+TITLE: Task 1: Perpetual calendar
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
* Task
|
||||
|
||||
A perpetual calendar can be used to determine the weekday (Monday, ..., Sunday) of any given date. You may for example know that the Berlin wall came down on November 9, 1989, but what was the weekday? It was a Thursday. Or what is the weekday of the 1000th anniversary of the Swiss confederation, to be celebrated on August 1, 2291? It will be a Saturday. The task of this exercise is to write a program that outputs the weekday of a given input date.
|
||||
|
||||
Your program will read the date from the input. The input is given as three integer values in the following order: Day, month, year. First the program must validate the input. Pay attention to special cases of February (leap years!) also, the date must be greater or equal to the reference date. If a date is invalid output invalid date. If the date is valid, calculate the weekday of this day. This can be done by calculating how many days lie between the date in question and a reference date whose weekday is known. As reference date use /Monday, 1st January 1900/. Finally, output the weekday as one word in English.
|
||||
|
||||
**Approach**: The goal of this exercise is to learn the usage of functions. For that, we split the program into the following sub tasks given as function declarations. Your task is to **implement the provided functions** in the calendar.cpp file, so that they perform the action that is specified in their post condition.
|
||||
|
||||
**Important: There is a well-known mathematical function to calculate the weekday of a date. Using this function is an incorrect solution as it defeats the purpose of this exercise.**
|
||||
|
||||
#+begin_src cpp
|
||||
// PRE: a year greater or equal than 1900
|
||||
// POST: returns whether that year was a leap year
|
||||
bool is_leap_year(int year);
|
||||
|
||||
// PRE: a year greater or equal than 1900
|
||||
// POST: returns the number of days in that year
|
||||
int count_days_in_year(int year);
|
||||
|
||||
// PRE: a month between 1 and 12 and a year greater or equal than 1900
|
||||
// POST: returns the number of days in the month of that year
|
||||
int count_days_in_month(int month, int year);
|
||||
|
||||
// PRE: n/a
|
||||
// POST: returns whether the given values represent a valid date
|
||||
bool is_valid_date(int day, int month, int year);
|
||||
|
||||
// PRE: the given values represent a valid date
|
||||
// POST: returns the number of days between January 1, 1900 and this date (excluding this date)
|
||||
int count_days(int day, int month, int year);
|
||||
|
||||
// PRE: the given values represent a (potentially invalid) date
|
||||
// POST: prints the weekday if the date is valid or "invalid date" otherwise.
|
||||
// Everything must be printed in lowercase.
|
||||
void print_weekday(int day, int month, int year);
|
||||
#+end_src
|
||||
|
||||
To complete the task, you have to provide the definition of the aforementioned functions.
|
||||
|
||||
The =calendar.cpp= file contains skeletons of the functions to be implemented. The =main.cpp= file contains testing functions and the main function. In the main function, a menu is printed to select the function that has to be tested.
|
||||
|
||||
**Important** the main is not editable. Required functions must be implemented in =calendar.cpp=.
|
||||
|
||||
**Additional notes:**
|
||||
|
||||
1. For function arguments that do **not** fulfill the precondition, the behavior is undefined.
|
||||
|
||||
1. There are a few opportunities here to use switch statements. Use them if they result in better readable code.
|
||||
|
||||
1. A leap year is defined as follows: It is an integer multiple of 4, except for years evenly divisible by 100, which are not leap years unless evenly divisible by 400. (Source: [[https://en.wikipedia.org/wiki/Leap_year][Wikipedia]])
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include "calendar.h"
|
||||
#include <string>
|
||||
|
||||
// PRE: a year greater or equal than 1900
|
||||
// POST: returns whether that year was a leap year
|
||||
bool is_leap_year(int year) {
|
||||
if (year >= 1900) {
|
||||
if (year % 4 == 0 && year % 100 != 0)
|
||||
return true;
|
||||
else if (year % 4 == 0 && year % 400 == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// PRE: a year greater or equal than 1900
|
||||
// POST: returns the number of days in that year
|
||||
int count_days_in_year(int year) {
|
||||
if (year >= 1900) {
|
||||
if (is_leap_year(year) == true)
|
||||
return 366;
|
||||
return 365;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// PRE: a month between 1 and 12 and a year greater or equal than 1900
|
||||
// POST: returns the number of days in the month of that year
|
||||
int count_days_in_month(int month, int year) {
|
||||
if (year >= 1900 && month > 0 && month <= 12) {
|
||||
if (is_leap_year(year) == true) {
|
||||
if (month % 2 != 0 && month != 2 && month <= 7)
|
||||
return 31;
|
||||
else if (month % 2 == 0 && month > 7)
|
||||
return 31;
|
||||
else if (month == 2)
|
||||
return 29;
|
||||
else
|
||||
return 30;
|
||||
} else {
|
||||
if (month % 2 != 0 && month != 2 && month <= 7)
|
||||
return 31;
|
||||
else if (month % 2 == 0 && month > 7)
|
||||
return 31;
|
||||
else if (month == 2)
|
||||
return 28;
|
||||
else
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// PRE: n/a
|
||||
// POST: returns whether the given values represent a valid date
|
||||
bool is_valid_date(int day, int month, int year) {
|
||||
if (day > 0 && day <= count_days_in_month(month, year) && month > 0 &&
|
||||
month <= 12 && year >= 1900)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// PRE: the given values represent a valid date
|
||||
// POST: returns the number of days between January 1, 1900 and this date
|
||||
// (excluding this date)
|
||||
int count_days(int day, int month, int year) {
|
||||
int res_day = 0;
|
||||
if (is_valid_date(day, month, year) == true) {
|
||||
for (int j = 1900; j < year; ++j) {
|
||||
res_day += count_days_in_year(j);
|
||||
}
|
||||
for (int j = 1; j < month; ++j) {
|
||||
res_day += count_days_in_month(j, year);
|
||||
}
|
||||
res_day += (day - 1);
|
||||
}
|
||||
return res_day;
|
||||
}
|
||||
|
||||
// PRE: the given values represent a (potentially invalid) date
|
||||
// POST: prints the weekday if the date is valid or "invalid date" otherwise.
|
||||
// Everything must be printed in lowercase.
|
||||
void print_weekday(int day, int month, int year) {
|
||||
if (is_valid_date(day, month, year) == true) {
|
||||
std::string days[7] = {"sunday", "monday", "tuesday", "wednesday",
|
||||
"thursday", "friday", "saturday"};
|
||||
std::cout << days[((count_days(day, month, year) + 1) % 7)];
|
||||
} else
|
||||
std::cout << "invalid date";
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,90 +0,0 @@
|
||||
#include "calendar.h"
|
||||
#include <string>
|
||||
|
||||
// PRE: a year greater or equal than 1900
|
||||
// POST: returns whether that year was a leap year
|
||||
bool is_leap_year(int year) {
|
||||
if (year >= 1900) {
|
||||
if (year % 4 == 0 && year % 100 != 0)
|
||||
return true;
|
||||
else if (year % 4 == 0 && year % 400 == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// PRE: a year greater or equal than 1900
|
||||
// POST: returns the number of days in that year
|
||||
int count_days_in_year(int year) {
|
||||
if (year >= 1900) {
|
||||
if (is_leap_year(year) == true)
|
||||
return 366;
|
||||
return 365;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// PRE: a month between 1 and 12 and a year greater or equal than 1900
|
||||
// POST: returns the number of days in the month of that year
|
||||
int count_days_in_month(int month, int year) {
|
||||
if (year >= 1900 && month > 0 && month <= 12) {
|
||||
if (is_leap_year(year) == true) {
|
||||
if (month % 2 != 0 && month != 2 && month <= 7)
|
||||
return 31;
|
||||
else if (month % 2 == 0 && month > 7)
|
||||
return 31;
|
||||
else if (month == 2)
|
||||
return 29;
|
||||
else
|
||||
return 30;
|
||||
} else {
|
||||
if (month % 2 != 0 && month != 2 && month <= 7)
|
||||
return 31;
|
||||
else if (month % 2 == 0 && month > 7)
|
||||
return 31;
|
||||
else if (month == 2)
|
||||
return 28;
|
||||
else
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// PRE: n/a
|
||||
// POST: returns whether the given values represent a valid date
|
||||
bool is_valid_date(int day, int month, int year) {
|
||||
if (day > 0 && day <= count_days_in_month(month, year) && month > 0 &&
|
||||
month <= 12 && year >= 1900)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// PRE: the given values represent a valid date
|
||||
// POST: returns the number of days between January 1, 1900 and this date
|
||||
// (excluding this date)
|
||||
int count_days(int day, int month, int year) {
|
||||
int res_day = 0;
|
||||
if (is_valid_date(day, month, year) == true) {
|
||||
for (int j = 1900; j < year; ++j) {
|
||||
res_day += count_days_in_year(j);
|
||||
}
|
||||
for (int j = 1; j < month; ++j) {
|
||||
res_day += count_days_in_month(j, year);
|
||||
}
|
||||
res_day += (day - 1);
|
||||
}
|
||||
return res_day;
|
||||
}
|
||||
|
||||
// PRE: the given values represent a (potentially invalid) date
|
||||
// POST: prints the weekday if the date is valid or "invalid date" otherwise.
|
||||
// Everything must be printed in lowercase.
|
||||
void print_weekday(int day, int month, int year) {
|
||||
if (is_valid_date(day, month, year) == true) {
|
||||
std::string days[7] = {"sunday", "monday", "tuesday", "wednesday",
|
||||
"thursday", "friday", "saturday"};
|
||||
std::cout << days[((count_days(day, month, year) + 1) % 7)];
|
||||
} else
|
||||
std::cout << "invalid date";
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
_This task is a text-based task. You do not need to write any program/C++ file: the answer should be written in functions.cpp._
|
||||
|
||||
Consider the functions implemented in `functions.cpp`. For each function, add proper pre- and post-conditions.
|
||||
|
||||
- If no pre-condition is needed, you can simply write "n/a".
|
||||
- The post-condition does not have to be a mathematical formula, e.g. it can be an informal description, but it must completely characterize the results and effects of the functions depending on the provided parameters.
|
||||
|
||||
**Note**: For the purposes of this task, you can ignore overflows.
|
57
Informatik_I/Exercise_5/Task_2/README.org
Normal file
@@ -0,0 +1,57 @@
|
||||
#+TITLE: Task 2: Pre- and post-conditions
|
||||
|
||||
/This task is a text-based task. You do not need to write any program/C++ file: the answer should be written in functions.cpp./
|
||||
|
||||
Consider the functions implemented in =functions.cpp=. For each function, add proper pre- and post-conditions.
|
||||
|
||||
- If no pre-condition is needed, you can simply write "n/a".
|
||||
- The post-condition does not have to be a mathematical formula, e.g. it can be an informal description, but it must completely characterize the results and effects of the functions depending on the provided parameters.
|
||||
|
||||
**Note**: For the purposes of this task, you can ignore overflows.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
// PRE: x > 0
|
||||
// POST: returns n^x
|
||||
int f1(int n, int x) {
|
||||
int res = 1;
|
||||
for (; x > 0; x--) {
|
||||
res *= n;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// PRE: n > 0
|
||||
// POST: returns number of devisions by 10 with n
|
||||
int f2(int n) {
|
||||
int i = 0;
|
||||
while (n > 0) {
|
||||
n = n / 10;
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
// PRE: n > 1
|
||||
// POST: returns a bool to determine if n is prime
|
||||
bool f3(int n) {
|
||||
int i = 2;
|
||||
for (; n % i != 0; ++i);
|
||||
return n == i;
|
||||
}
|
||||
|
||||
// PRE: n is square number
|
||||
// POST: returns root of n
|
||||
int f4(int n) {
|
||||
int i = 0;
|
||||
while (i * i != n) {
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,38 +0,0 @@
|
||||
// PRE: x > 0
|
||||
// POST: returns n^x
|
||||
int f1(int n, int x) {
|
||||
int res = 1;
|
||||
for (; x > 0; x--) {
|
||||
res *= n;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// PRE: n > 0
|
||||
// POST: returns number of devisions by 10 with n
|
||||
int f2(int n) {
|
||||
int i = 0;
|
||||
while (n > 0) {
|
||||
n = n / 10;
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
// PRE: n > 1
|
||||
// POST: returns a bool to determine if n is prime
|
||||
bool f3(int n) {
|
||||
int i = 2;
|
||||
for (; n % i != 0; ++i);
|
||||
return n == i;
|
||||
}
|
||||
|
||||
// PRE: n is square number
|
||||
// POST: returns root of n
|
||||
int f4(int n) {
|
||||
int i = 0;
|
||||
while (i * i != n) {
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
_This task is a text based task. You do not need to write any program/C++ file: the answer should be written in main.md (and might include code fragments if questions ask for them)._
|
||||
|
||||
# Task:
|
||||
|
||||
What are the problems (if any) with the following functions? Fix them and find appropriate [pre-](https://en.wikipedia.org/wiki/Precondition) and [postconditions](https://en.wikipedia.org/wiki/Postcondition).
|
||||
|
||||
1. function is_even:
|
||||
|
||||
```cpp
|
||||
|
||||
bool is_even(int i) {
|
||||
if (i % 2 == 0) return true;
|
||||
}
|
||||
```
|
||||
|
||||
1. function invert:
|
||||
|
||||
```cpp
|
||||
double invert(int x) {
|
||||
double result;
|
||||
if (x != 0) {
|
||||
result = 1.0 / x;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
```
|
||||
|
||||
**Hint**: The C++ compiler does not protect you from certain types of errors. Therefore, even if you run a program in Code Expert, it is not guaranteed that the behaviour you observe is the “real” one. We have prepared a [program tracing handout](https://lec.inf.ethz.ch/ifmp/2023/guides/tracing/intro.html) that shows how to execute a program with a pen and paper and which conditions indicate bugs in the executed program not caught by the C++ compiler.
|
74
Informatik_I/Exercise_5/Task_3/README.org
Normal file
@@ -0,0 +1,74 @@
|
||||
#+TITLE: Fixing Functions
|
||||
|
||||
/This task is a text based task. You do not need to write any program/C++ file: the answer should be written in main.md (and might include code fragments if questions ask for them)./
|
||||
|
||||
* Task:
|
||||
|
||||
What are the problems (if any) with the following functions? Fix them and find appropriate [[https://en.wikipedia.org/wiki/Precondition][pre-]] and [[https://en.wikipedia.org/wiki/Postcondition][postconditions]].
|
||||
|
||||
1. function is_even:
|
||||
|
||||
#+begin_src cpp
|
||||
bool is_even(int i) {
|
||||
if (i % 2 == 0) return true;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
1. function invert:
|
||||
|
||||
#+begin_src cpp
|
||||
|
||||
double invert(int x) {
|
||||
double result;
|
||||
if (x != 0) {
|
||||
result = 1.0 / x;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
**Hint**: The C++ compiler does not protect you from certain types of errors. Therefore, even if you run a program in Code Expert, it is not guaranteed that the behaviour you observe is the “real” one. We have prepared a [[https://lec.inf.ethz.ch/ifmp/2023/guides/tracing/intro.html][programming tracing handout]] that shows how to execute a program with a pen and paper and which conditions indicate bugs in the executed program not caught by the C++ compiler.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src markdown
|
||||
Please write your solution here.
|
||||
For your convenience we have added a template for your answers below.
|
||||
|
||||
Note: Remember to also describe the problem of the function.
|
||||
|
||||
# Function `c++|is_even`:
|
||||
|
||||
The problem with this function is that it does not return a bool if the number `i` is uneven.
|
||||
|
||||
```c++
|
||||
// PRE: n/a
|
||||
// POST: returns true if i is even. If not it returns false.
|
||||
bool is_even(int i) {
|
||||
if (i % 2 == 0) return true;
|
||||
else return false;
|
||||
}
|
||||
```
|
||||
|
||||
# Function `c++|invert`:
|
||||
|
||||
The problem with this function is
|
||||
|
||||
```c++
|
||||
// PRE: x is positive or negative but not zero.
|
||||
// POST: returns inverse with respect to multiplication of x.
|
||||
double invert(int x) {
|
||||
// TODO: Fix code below.
|
||||
if (x != 0) {
|
||||
return 1.0 / x;
|
||||
}
|
||||
else
|
||||
std::cout << "0 has no inverse!";
|
||||
}
|
||||
```
|
||||
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,35 +0,0 @@
|
||||
Please write your solution here.
|
||||
For your convenience we have added a template for your answers below.
|
||||
|
||||
Note: Remember to also describe the problem of the function.
|
||||
|
||||
# Function `c++|is_even`:
|
||||
|
||||
The problem with this function is that it does not return a bool if the number `i` is uneven.
|
||||
|
||||
```c++
|
||||
// PRE: n/a
|
||||
// POST: returns true if i is even. If not it returns false.
|
||||
bool is_even(int i) {
|
||||
if (i % 2 == 0) return true;
|
||||
else return false;
|
||||
}
|
||||
```
|
||||
|
||||
# Function `c++|invert`:
|
||||
|
||||
The problem with this function is
|
||||
|
||||
```c++
|
||||
// PRE: x is positive or negative but not zero.
|
||||
// POST: returns inverse with respect to multiplication of x.
|
||||
double invert(int x) {
|
||||
// TODO: Fix code below.
|
||||
if (x != 0) {
|
||||
return 1.0 / x;
|
||||
}
|
||||
else
|
||||
std::cout << "0 has no inverse!";
|
||||
}
|
||||
```
|
||||
|
@@ -1,64 +1,139 @@
|
||||
Task
|
||||
#+TITLE: Task 4: Run-length encoding
|
||||
#+AUTHOR: JirR02
|
||||
|
||||
Run-length encoding is a simple data compression technique that represents $N$ consecutive identical values $W$ (a run) by a tuple ($N,W$). This method is applied for image compression, for instance. Example:
|
||||
* Task
|
||||
|
||||

|
||||
Run-length encoding is a simple data compression technique that represents \(N\) consecutive identical values \(W\) (a run) by a tuple (\(N,W\)). This method is applied for image compression, for instance. Example:
|
||||
|
||||
Write a program that implements run-length encoding and decoding of a byte sequence as described above. By a byte, we mean an integer value in the range $\[ 0; 255 \]$. Use the stepwise refinement method to implement the program. **Your solution must consist of at least two functions, encode and decode. Please implement them in `run_length.cpp`.**
|
||||
[[./pictures/encode_decode.png]]
|
||||
|
||||
Write a program that implements run-length encoding and decoding of a byte sequence as described above. By a byte, we mean an integer value in the range \([ 0; 255 ]\). Use the stepwise refinement method to implement the program. **Your solution must consist of at least two functions, encode and decode. Please implement them in =run_length.cpp=.**
|
||||
|
||||
The _input_ is structured as follows:
|
||||
|
||||
1. One integer that determines whether to encode: $0$ or decode: $1$.
|
||||
1. Byte sequence to be encoded or decoded (of arbitrary length). If a value outside the range $\[ 0; 255 \]$(except $-1$) is entered, output `error` and stop the en- or decoding.
|
||||
1. One integer that determines whether to encode: \(0\) or decode: \(1\).
|
||||
1. Byte sequence to be encoded or decoded (of arbitrary length). If a value outside the range \([ 0; 255 ]\) (except $-1$) is entered, output =error= and stop the en- or decoding.
|
||||
1. Integer -1 signaling the end of the byte sequence. Any extra input should be ignored.
|
||||
|
||||
For the example above, the inputs are:
|
||||
|
||||
**Encode:**
|
||||
|
||||
```sh
|
||||
#+begin_src shell
|
||||
0 42 42 85 85 85 85 172 172 172 13 13 42 -1
|
||||
```
|
||||
#+end_src
|
||||
|
||||
**Decode:**
|
||||
|
||||
```sh
|
||||
#+begin_src shell
|
||||
1 2 42 4 85 3 172 2 13 1 42 -1
|
||||
```
|
||||
#+end_src
|
||||
|
||||
_The output_ is expected on a single line in the following format:
|
||||
|
||||
1. A start value to indicate the begin of the sequence: either $0$ for decoded values or $1$ for encoded values.
|
||||
1. A start value to indicate the begin of the sequence: either \(0\) for decoded values or \(1\) for encoded values.
|
||||
1. The values that make up the encoded or decoded byte sequence.
|
||||
1. The value $-1$ to indicate the end of the sequence.
|
||||
1. The value \(-1\) to indicate the end of the sequence.
|
||||
|
||||
I.e., you can 'reuse' the output as the input.
|
||||
|
||||
**Note 1):** As the encoded sequence must be a _byte_ sequence, runs of length 256 or longer need to be split into multiple runs of length 255 at most.
|
||||
|
||||
**Note 2):** The first input element (the integer that determines wether to encode or decode), is already consumed by the `main`, that calls either the encode or decode function.
|
||||
**Note 2):** The first input element (the integer that determines wether to encode or decode), is already consumed by the =main=, that calls either the encode or decode function.
|
||||
|
||||
**Note 3):** Your output should not be followed by new line (i.e., do not use `std::endl` or `\n` at the end of your printout)
|
||||
**Note 3):** Your output should not be followed by new line (i.e., do not use =std::endl= or =\n= at the end of your printout)
|
||||
|
||||
**Note 4):** The program will print your output (the result of the decoding or encoding), surrounded by asterisks. You don't have to worry about them, the autograder can safely recognize your solution
|
||||
|
||||
**Note 5):** Output only what is strictly required (the encoded or decoded sequence). The autograder will only accept output that exactly matches the expected result. For all other messages, use `std::cerr` as in:
|
||||
**Note 5):** Output only what is strictly required (the encoded or decoded sequence). The autograder will only accept output that exactly matches the expected result. For all other messages, use =std::cerr= as in:
|
||||
|
||||
```cpp
|
||||
#+begin_src cpp
|
||||
std::cerr << "This is a test message\n"
|
||||
```
|
||||
#+end_src
|
||||
|
||||
Those will be ignored by the autograder.
|
||||
|
||||
**Special cases**: While decoding a byte sequence two special cases can occur. These must be handled as follows:
|
||||
|
||||
1. If a byte sequence ends in the middle of a tuple, stop printing the output of en- or decoding and output `error`.
|
||||
1. Tuples of run-length 0 are possible. For such tuples, output only the leading indicator ($0$/$1$) and the trailing $-1$.
|
||||
1. If a byte sequence ends in the middle of a tuple, stop printing the output of en- or decoding and output =error=.
|
||||
1. Tuples of run-length 0 are possible. For such tuples, output only the leading indicator (\(0\)/\(1\)) and the trailing \(-1\).
|
||||
|
||||
**Hint**: You can enter multiple numbers at once separated with a space on the console, e.g, you can copy and paste the above examples, and sequentially read them using multiple `std::cin >> _var_` calls.
|
||||
**Hint**: You can enter multiple numbers at once separated with a space on the console, e.g, you can copy and paste the above examples, and sequentially read them using multiple =std::cin >> _var_= calls.
|
||||
|
||||
Also note that, even though the program's output and the user input are both shown in the same console, they are processed separately internally, so you do not have to worry that the two will mix: if your program outputs something to the console before reading another value, it will only read the user input and not the previous output value. See the Calculator code in the Lecture 4 handout for an example of reading input and producing output in a loop.
|
||||
|
||||
Finally, part of the correctness for this task is the termination of your code, so pay attention to this. The autograder may not catch these kinds of mistakes.
|
||||
|
||||
**Restrictions**: using a vector, an array or a similar data structure in any part of your code is not allowed and would result in 0 points.
|
||||
|
||||
* Solution
|
||||
|
||||
#+begin_src cpp
|
||||
#include "run_length.h"
|
||||
|
||||
void encode() {
|
||||
int i;
|
||||
int c;
|
||||
int count;
|
||||
std::cin >> i;
|
||||
std::cout << 1 << " ";
|
||||
while (i != -1) {
|
||||
count = 0;
|
||||
c = i;
|
||||
while (i == c && i >= 0 && i <= 255) {
|
||||
++count;
|
||||
std::cin >> i;
|
||||
if (count == 255) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < -1 || i > 255) {
|
||||
if (count == 0) {
|
||||
std::cout << "error";
|
||||
return;
|
||||
} else {
|
||||
std::cout << count << " ";
|
||||
std::cout << c << " ";
|
||||
std::cout << "error";
|
||||
return;
|
||||
}
|
||||
}
|
||||
std::cout << count << " ";
|
||||
std::cout << c << " ";
|
||||
}
|
||||
std::cout << -1;
|
||||
}
|
||||
|
||||
void decode() {
|
||||
int i;
|
||||
int count;
|
||||
std::cin >> count;
|
||||
std::cin >> i;
|
||||
std::cout << 0 << " ";
|
||||
while (count != -1) {
|
||||
if (i < -1 || i > 255) {
|
||||
std::cout << "error";
|
||||
return;
|
||||
}
|
||||
if (count < -1 || count > 255) {
|
||||
std::cout << "error";
|
||||
return;
|
||||
}
|
||||
for (int j = 0; j < count; ++j) {
|
||||
std::cout << i << " ";
|
||||
}
|
||||
std::cin >> count;
|
||||
if (count != -1)
|
||||
std::cin >> i;
|
||||
if (i == -1) {
|
||||
std::cout << "error";
|
||||
return;
|
||||
}
|
||||
}
|
||||
std::cout << -1;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
-----
|
||||
|
||||
Made by JirR02 in Switzerland 🇨🇭
|
@@ -1,63 +0,0 @@
|
||||
#include "run_length.h"
|
||||
|
||||
void encode() {
|
||||
int i;
|
||||
int c;
|
||||
int count;
|
||||
std::cin >> i;
|
||||
std::cout << 1 << " ";
|
||||
while (i != -1) {
|
||||
count = 0;
|
||||
c = i;
|
||||
while (i == c && i >= 0 && i <= 255) {
|
||||
++count;
|
||||
std::cin >> i;
|
||||
if (count == 255) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < -1 || i > 255) {
|
||||
if (count == 0) {
|
||||
std::cout << "error";
|
||||
return;
|
||||
} else {
|
||||
std::cout << count << " ";
|
||||
std::cout << c << " ";
|
||||
std::cout << "error";
|
||||
return;
|
||||
}
|
||||
}
|
||||
std::cout << count << " ";
|
||||
std::cout << c << " ";
|
||||
}
|
||||
std::cout << -1;
|
||||
}
|
||||
|
||||
void decode() {
|
||||
int i;
|
||||
int count;
|
||||
std::cin >> count;
|
||||
std::cin >> i;
|
||||
std::cout << 0 << " ";
|
||||
while (count != -1) {
|
||||
if (i < -1 || i > 255) {
|
||||
std::cout << "error";
|
||||
return;
|
||||
}
|
||||
if (count < -1 || count > 255) {
|
||||
std::cout << "error";
|
||||
return;
|
||||
}
|
||||
for (int j = 0; j < count; ++j) {
|
||||
std::cout << i << " ";
|
||||
}
|
||||
std::cin >> count;
|
||||
if (count != -1)
|
||||
std::cin >> i;
|
||||
if (i == -1) {
|
||||
std::cout << "error";
|
||||
return;
|
||||
}
|
||||
}
|
||||
std::cout << -1;
|
||||
}
|