mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-06 04:27:53 +02:00
75 lines
3.6 KiB
XML
75 lines
3.6 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
|
<style>
|
|
.bg{fill:#0a0a0f}.pnl{fill:#12121a;stroke:#1a1a2e}.hdr{fill:#12121a}
|
|
.title{font:bold 42px 'Courier New',monospace;fill:#00ff41}
|
|
.sub{font:bold 28px 'Courier New',monospace;fill:#00d4ff}
|
|
.txt{font:24px 'Courier New',monospace;fill:#c0c0c0}
|
|
.dim{font:20px 'Courier New',monospace;fill:#888}
|
|
.grn{font:bold 24px 'Courier New',monospace;fill:#00ff41}
|
|
.red{font:bold 24px 'Courier New',monospace;fill:#ff0040}
|
|
.cyn{font:bold 24px 'Courier New',monospace;fill:#00d4ff}
|
|
.amb{font:bold 24px 'Courier New',monospace;fill:#ffaa00}
|
|
.badge{stroke:#00ff41;rx:14}
|
|
</style>
|
|
<rect class="bg" width="1200" height="800"/>
|
|
<rect class="hdr" x="0" y="0" width="1200" height="100" rx="0"/>
|
|
<text class="title" x="600" y="52" text-anchor="middle">Arithmetic & Increment</text>
|
|
<text class="dim" x="600" y="88" text-anchor="middle">Math Operations and Post/Pre Increment</text>
|
|
|
|
<!-- Arithmetic Panel -->
|
|
<rect class="pnl" x="30" y="110" width="555" height="290" rx="8"/>
|
|
<text class="sub" x="50" y="145">Arithmetic Operators</text>
|
|
<rect x="50" y="160" width="515" height="220" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
|
<text class="amb" x="70" y="195">+</text>
|
|
<text class="dim" x="130" y="195">5 + 10 = 15</text>
|
|
<text class="dim" x="360" y="195">Addition</text>
|
|
<text class="amb" x="70" y="230">-</text>
|
|
<text class="dim" x="130" y="230">10 - 5 = 5</text>
|
|
<text class="dim" x="360" y="230">Subtraction</text>
|
|
<text class="amb" x="70" y="265">*</text>
|
|
<text class="dim" x="130" y="265">5 * 10 = 50</text>
|
|
<text class="dim" x="360" y="265">Multiplication</text>
|
|
<text class="amb" x="70" y="300">/</text>
|
|
<text class="dim" x="130" y="300">10 / 5 = 2</text>
|
|
<text class="dim" x="360" y="300">Division</text>
|
|
<text class="amb" x="70" y="335">%</text>
|
|
<text class="dim" x="130" y="335">10 % 3 = 1</text>
|
|
<text class="dim" x="360" y="335">Modulus</text>
|
|
|
|
<!-- Increment Panel -->
|
|
<rect class="pnl" x="615" y="110" width="555" height="290" rx="8"/>
|
|
<text class="sub" x="635" y="145">Post vs Pre Increment</text>
|
|
|
|
<rect x="635" y="165" width="515" height="100" rx="6" fill="#00ff41" fill-opacity="0.08" stroke="#00ff41"/>
|
|
<text class="grn" x="655" y="195">Post: x++</text>
|
|
<text class="txt" x="655" y="225">Use value THEN increment</text>
|
|
<text class="dim" x="655" y="250">a = x++ --> a=5, x=6</text>
|
|
|
|
<rect x="635" y="275" width="515" height="100" rx="6" fill="#00d4ff" fill-opacity="0.08" stroke="#00d4ff"/>
|
|
<text class="cyn" x="655" y="305">Pre: ++x</text>
|
|
<text class="txt" x="655" y="335">Increment THEN use value</text>
|
|
<text class="dim" x="655" y="360">b = ++x --> x=7, b=7</text>
|
|
|
|
<!-- Trace Example -->
|
|
<rect class="pnl" x="30" y="415" width="1140" height="225" rx="8"/>
|
|
<text class="sub" x="50" y="450">Post-Increment Step by Step</text>
|
|
<rect x="50" y="465" width="1100" height="155" rx="6" fill="#0a0a0f" stroke="#1a1a2e"/>
|
|
|
|
<text class="cyn" x="70" y="495">int x = 5;</text>
|
|
<text class="cyn" x="70" y="530">int result = x++;</text>
|
|
|
|
<text class="dim" x="470" y="495">Step 1: result = x</text>
|
|
<text class="grn" x="750" y="495">result gets 5</text>
|
|
<text class="dim" x="470" y="530">Step 2: x = x + 1</text>
|
|
<text class="grn" x="750" y="530">x becomes 6</text>
|
|
|
|
<text class="amb" x="70" y="575">Final: result = 5</text>
|
|
<text class="amb" x="400" y="575">x = 6</text>
|
|
<text class="dim" x="560" y="575">"Use first, THEN increment"</text>
|
|
|
|
<!-- Key -->
|
|
<rect class="pnl" x="30" y="655" width="1140" height="80" rx="8"/>
|
|
<text class="red" x="50" y="690">In our code:</text>
|
|
<text class="txt" x="250" y="690">int increment_operator = x++;</text>
|
|
<text class="dim" x="50" y="718">x was 5, so increment_operator = 5, then x becomes 6</text>
|
|
</svg> |