Compare commits

61 Commits
hugo ... main

Author SHA1 Message Date
169ae776f5 Updated cpp.php 2026-02-27 14:50:14 -06:00
787f48ad90 Updated cpp.php 2026-02-27 14:38:32 -06:00
950f199949 Updated cpp.php 2026-02-27 14:24:37 -06:00
294f8c30f5 Updated cpp.php 2026-02-27 14:24:05 -06:00
eb076b3eac Changed margins 2026-02-27 13:56:09 -06:00
88b9a79f91 q 2026-02-25 14:40:38 -06:00
af7711af0d a 2026-02-25 14:32:57 -06:00
8814a748cd updated physics notes 2026-02-24 17:32:40 -06:00
2c6df9f97c a 2026-02-24 17:14:50 -06:00
lucasrufkahr
c9716d10a9 a 2026-02-24 17:13:56 -06:00
5d1f45beff updated foot 2026-02-24 17:07:24 -06:00
f0f37d6d2a a 2026-02-24 17:06:37 -06:00
e97ec633b5 a 2026-02-24 17:05:46 -06:00
657001cf85 a 2026-02-24 17:03:58 -06:00
6f767e9cdb a 2026-02-24 17:03:15 -06:00
7c7acd5e4d a 2026-02-24 17:01:04 -06:00
460827c2e0 a 2026-02-24 17:00:19 -06:00
ef073f74b4 rwar 2026-02-24 16:58:36 -06:00
49091b22eb a 2026-02-24 16:56:10 -06:00
357ea5af27 test 2026-02-24 16:55:22 -06:00
9e96bff753 test 2026-02-24 16:54:52 -06:00
5b45035d9b test 2026-02-24 16:54:09 -06:00
8a8e662edb test 2026-02-24 16:53:41 -06:00
83b02cc63b a 2026-02-24 16:53:14 -06:00
df747e9aa8 a 2026-02-24 16:52:21 -06:00
3fe49edf04 a 2026-02-24 16:51:48 -06:00
d14b145cba a 2026-02-24 16:51:22 -06:00
ebbb7b2ac0 updated 2026-02-24 16:50:00 -06:00
3c7c880817 test 2026-02-24 16:48:57 -06:00
a05c7b5b31 a 2026-02-24 16:46:13 -06:00
bdb19750f0 updated footer 2026-02-24 16:45:17 -06:00
43aa4e203f update index.php 2026-02-24 16:44:37 -06:00
511b311de5 updated site 2026-02-24 16:43:51 -06:00
c6ee3ee346 UPDATED STYLE.CSS 2026-02-24 16:38:52 -06:00
04177c38fb Updated cpp.php 2026-02-24 16:36:23 -06:00
bd7e0ea7a4 update 2026-02-24 16:35:02 -06:00
7573f6a8fa uPDATED CPP.PHP 2026-02-24 16:34:24 -06:00
6adaaaca79 updated 2026-02-24 16:33:40 -06:00
bd4aa4a579 Updated 2026-02-24 16:32:54 -06:00
d5d5aee2a4 test 2026-02-24 15:53:35 -06:00
a1efcfd062 updated index 2026-02-24 15:53:23 -06:00
a5195f9c39 php test 2026-02-24 15:51:29 -06:00
badfcebf07 Updated site 2026-02-24 15:43:58 -06:00
Lucas Rufkahr
378cce391a updated 2026-02-24 08:26:57 -06:00
Lucas Rufkahr
f9dce07722 a 2026-02-24 08:20:40 -06:00
Lucas Rufkahr
16bf27496d a 2026-02-24 08:20:07 -06:00
Lucas Rufkahr
2aef259be5 updated index.html 2026-02-24 08:18:30 -06:00
Lucas Rufkahr
0d12d771b6 updated font 2026-02-24 08:17:34 -06:00
Lucas Rufkahr
35775b6ddd Updated nav 2026-02-24 08:14:59 -06:00
Lucas Rufkahr
4514f44340 Updated pages 2026-02-24 08:13:20 -06:00
Lucas Rufkahr
42fbf93a20 Updated header section 2026-02-24 08:11:31 -06:00
Lucas Rufkahr
a2c78b2c72 Added stylesheet include 2026-02-24 08:09:03 -06:00
Lucas Rufkahr
c8f8d95f23 updated index.html 2026-02-24 08:03:58 -06:00
b24119799d Updated cpp.html 2026-02-23 13:41:20 -06:00
a08ebf8d7a Updated cPP.html 2026-02-23 12:19:58 -06:00
0470b1394f Fixed notes list links 2026-02-23 08:30:26 -06:00
e3f726e1ba Created notes index, updated nav bar. 2026-02-23 08:29:19 -06:00
63809a4f9d Added hyperlinks to notes list 2026-02-23 08:27:39 -06:00
e08195b0f1 Updated circuits.html, physics.html 2026-02-23 08:26:26 -06:00
6e36af0390 Updated nav on cpp.html 2026-02-23 08:25:10 -06:00
48d8a19fc5 updated nav bar on index 2026-02-23 08:10:06 -06:00
16 changed files with 572 additions and 163 deletions

11
about/index.php Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://lukerufkahr.com/assets/style.css">
</head>
<body>
<?php include '.././snippet/header.php'?>
<main>
<h1>About me</h1>
</main>
<?php include '.././snippet/footer.php'?>
</body>

BIN
assets/.style.css.swp Normal file

Binary file not shown.

49
assets/style.css Normal file
View File

@@ -0,0 +1,49 @@
body {
margin:0;
padding:0;
font-family: sans-serif;
}
main {
margin:0em 10em 0em 10em;
height:90%;
}
header, footer {
font-size: 1rem;
padding: 0.5rem;
}
header {
background-color:black;
}
header * {
display: inline;
color:white;
}
header h1 {
font-size: 1rem;
}
nav {
display:block
}
nav * {
padding-right: 1em;
}
code, pre {
whitespace: normal;
}
.cblock {
padding-left: 1em;
padding-right: 1em;
display: inline-block;
margin-left: 5em;
background-color:lightgray;
}
table,td, th {
text-align:left;
width: 50em;
border: 1px solid black;
border-collapse: collapse;
}

11
fun/index.php Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://lukerufkahr.com/assets/style.css">
</head>
<body>
<?php include '.././snippet/header.php'?>
<main>
<h1>Random things</h1>
</main>
<?php include '.././snippet/footer.php'?>
</body>

View File

@@ -1,9 +0,0 @@
<!DOCTYPE html>
<body>
<h1>lukerufkahr.com</h1>
<ul>
<li>Physics</li>
<li>Circuits</li>
<li><a href="notes/cpp.html">C++</a></li>
</ul>
</body>

19
index.php Normal file
View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<head>
<title>lukerufkahr.com</title>
<link rel="stylesheet" href="https://lukerufkahr.com/assets/style.css">
<meta content='width=device-width, initial-scale=1' name='viewport'/>
</head>
<body>
<?php include './snippet/header.php'?>
<main>
<?php echo '<p>Hello World</p>'; ?>
<h1>Welcome to my page.</h1>
<ul>
<li><a href="https://lukerufkahr.com/notes/physics.php">Physics</a></li>
<li><a href="https://lukerufkahr.com/notes/circuits.php">Circuits</a></li>
<li><a href="https://lukerufkahr.com/notes/cpp.php">C++</a></li>
</ul>
</main>
<?php include './snippet/footer.php'?>
</body>

11
library/index.php Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://lukerufkahr.com/assets/style.css">
</head>
<body>
<?php include '.././snippet/header.php'?>
<main>
<h1>Library</h1>
</main>
<?php include '.././snippet/footer.php'?>
</body>

10
notes/circuits.php Normal file
View File

@@ -0,0 +1,10 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://lukerufkahr.com/assets/style.css">
</head>
<body>
<?php include '.././snippet/header.php'?>
<main>
</main>
<?php include '.././snippet/footer.php'?>
</body>

View File

@@ -1,154 +0,0 @@
<!DOCTYPE html>
<head>
<style>
body {
margin:0;
padding:0;
}
main {
margin:2em;
}
header {
display:block;
width: 100%;
background-color:black;
padding:1em;
}
header * {
color:white;
display:inline;
padding-left:1em;
}
code, pre {
whitespace: normal;
}
.cblock {
padding-left: 1em;
padding-right: 1em;
display: inline-block;
margin-left: 5em;
background-color:lightgray;
}
</style>
</head>
<body>
<header>
<span style="font-size: 32px;">Lucas Rufkahr</span>
<a href="https://lukerufkahr.com">Home</a>
<a href="https://lukerufkahr.com/notes.html">Notes</a>
<a href="https://lukerufkahr.com/fun_stuff.html">Fun</a>
</header>
<main>
<h1>C++ Notes</h1>
<h2>ToC</h2>
<ul>
<li><a href="#basics">Basics</a></li>
<ul>
<li><a href="#basics-introduction">Introduction</a></li>
<li><a href="#basics-variables">Variables</a>
<li><a href="#basics-operators">Operators</a>
</ul>
<li><a href="#control_flow">Control Flow</a></li>
</ul>
<hr>
<h2 id="basics">Basics</h2>
<h3 id="basics-introduction">I. Introduction</h3>
<p>
A C++ program generally consists of preprocessor directives and the main function.<br>
<br>
A preprocessor directive tells the C++ preprocessor what to do before compiling. You can use this to include files, create macros, and determine compiling based on conditions. For example, include a file using <code>#include <iostream></code> This will include the iostream file from the C++ standard library.<br>
<br>
The main function looks like:
<code class="cblock"><pre>int main() {
<!-----> std::cout << "Hello world" << '\n';
<!-----> return 0;
<!----->}</pre></code>
The <code>int main() {</code> is the declaration of the main function denoting it returns type int. <code>return 0;</code> is the return statement for the function. It is returning the integer 0. This tells the operating system, OK Quit the program safely.
</p>
<h3 id="basics-variables">II. Variables</h3>
<p>
A variable lets you allocate some memory in the computer and use it to store values. You can also recall the values for later. Variables contain a memory address and an identifier. An identifier can be *almost* anything you wish it to be.<br>
<br>
Variables naming rules:
<ul>
<li>Cannot start with a number.</li>
<li>Can only contain alphanumeric characters and underscores.</li>
<li>Cannot contain any reserved keywords <a href="https://en.cppreference.com/w/cpp/keyword.html">(see here)</a>.
<li>If starting with an underscore, it can only start with one.</li>
</ul>
All variables have denoted types and they refer to what kind of variable it is. All variables also have a bit size and this denotes the range of values that can be stored.<br>
<br>
Variable types:
<ul>
<li>Integers:</li>
<ul>
<li>short int:</li>
<ul>
<li>Size: 2 bytes.</li>
<li>Range: -32,768 to 32,767</li>
</ul>
<li>int:</li>
<ul>
<li>Size: 4 bytes.</li>
<li>Range: -2 billion to 2 billion</li>
</ul>
<li>short:</li>
<ul>
<li>Size: 8 bytes.</li>
</ul>
</ul>
<li>Floats:</li>
<ul>
<li>float:</li>
<ul>
<li>Size: 4 bytes.</li>
<li>6 significant figures.</li>
</ul>
<li>double:</li>
<ul>
<li>Size: 8 bytes.</li>
<li>15 significant figures.</li>
</ul>
<li>long double:</li>
<ul>
<li>Size: 16 bytes.</li>
<li>19 significant figures.</li>
</ul>
</ul>
<li>Character:</li>
<ul>
<li>Type: char</li>
Stores an integer value representative of an "ASCII" character.
<li>Size: 1 byte.</li>
</ul>
<li>String:</li>
<ul>
Stores an indexable array of characters.
<li>Usage: <code>#include <string></code>
<li>Variable creation: <code>std::string identifier = "string literal";</code></li>
</ul>
<li>Boolean:</li>
<ul>
Stores an integer value of 0 or 1 representative of false or true respectively.
<li>Type: bool</li>
<li>Size: 1 byte</li>
</ul>
</ul>
<br>
Variables are always declared before they are initialized. This means you must determine the type and the identifier before you store any values into it.<br>
<br>
<code class="cblock"><pre>int main() {
<!-----> int a; // Declaration
<!-----> a = 1; // Initialization
<!-----> int b = 2; // Declaration then initialization
<!----->}</pre></code><br>
<br>
Constant types are variables identified by <code>const</code> in their type definition. These are not allowed to be modified after they are declared and must be initialized at declaration.
</p>
<h3 id="#basics-operators">Operators</h3>
<h2 id="control_flow">Control Flow</h2>
</main>
</body>

379
notes/cpp.php Normal file
View File

@@ -0,0 +1,379 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://lukerufkahr.com/assets/style.css">
</head>
<body>
<?php include '.././snippet/header.php'?>
<main>
<h1>C++ Notes</h1>
<h2>ToC</h2>
<ul>
<li><a href="#basics">Basics</a></li>
<ul>
<li><a href="#basics-introduction">Introduction</a></li>
<li><a href="#basics-variables">Variables</a>
<li><a href="#basics-operators">Operators</a>
</ul>
<li><a href="#control_flow">Control Flow</a></li>
<ul>
<li><a href="#control_flow-branching">Decision Branching</a></li>
<li><a href="#control_flow-loops">Loops</a></li>
<li><a href="#control_flow-switches">Switches</a></li>
<li><a href="#control_flow-ternary">Ternary Operator</a></li>
</ul>
<li><a href="#other">Other Topics</a></li>
<ul>
<li><a href="#other_string-manipulation">String Manipulation</a></li>
</ul>
</ul>
<hr>
<h2 id="basics">Basics</h2>
<h3 id="basics-introduction">I. Introduction</h3>
<p>
A C++ program generally consists of preprocessor directives and the main function.<br>
<br>
A preprocessor directive tells the C++ preprocessor what to do before compiling. You can use this to include files, create macros, and determine compiling based on conditions. For example, include a file using <code>#include <iostream></code> This will include the iostream file from the C++ standard library.<br>
<br>
The main function looks like:
<code class="cblock"><pre>int main() {
<!---------> std::cout << "Hello world" << '\n';
<!---------> return 0;
<!--------->}</pre></code>
The <code>int main() {</code> is the declaration of the main function denoting it returns type int. <code>return 0;</code> is the return statement for the function. It is returning the integer 0. This tells the operating system, OK Quit the program safely.
</p>
<h3 id="basics-variables">II. Variables</h3>
<p>
A variable lets you allocate some memory in the computer and use it to store values. You can also recall the values for later. Variables contain a memory address and an identifier. An identifier can be *almost* anything you wish it to be.<br>
<br>
Variables naming rules:
<ul>
<li>Cannot start with a number.</li>
<li>Can only contain alphanumeric characters and underscores.</li>
<li>Cannot contain any reserved keywords <a href="https://en.cppreference.com/w/cpp/keyword.html">(see here)</a>.
<li>If starting with an underscore, it can only start with one.</li>
</ul>
All variables have denoted types and they refer to what kind of variable it is. All variables also have a bit size and this denotes the range of values that can be stored.<br>
<br>
Variable types:
<ul>
<li>Integers:</li>
<ul>
<li>short int:</li>
<ul>
<li>Size: 2 bytes.</li>
<li>Range: -32,768 to 32,767</li>
</ul>
<li>int:</li>
<ul>
<li>Size: 4 bytes.</li>
<li>Range: -2 billion to 2 billion</li>
</ul>
<li>short:</li>
<ul>
<li>Size: 8 bytes.</li>
</ul>
</ul>
<li>Floats:</li>
<ul>
<li>float:</li>
<ul>
<li>Size: 4 bytes.</li>
<li>6 significant figures.</li>
</ul>
<li>double:</li>
<ul>
<li>Size: 8 bytes.</li>
<li>15 significant figures.</li>
</ul>
<li>long double:</li>
<ul>
<li>Size: 16 bytes.</li>
<li>19 significant figures.</li>
</ul>
</ul>
<li>Character:</li>
<ul>
<li>Type: char</li>
Stores an integer value representative of an "ASCII" character.
<li>Size: 1 byte.</li>
</ul>
<li>String:</li>
<ul>
Stores an indexable array of characters.
<li>Usage: <code>#include <string></code>
<li>Variable creation: <code>std::string identifier = "string literal";</code></li>
</ul>
<li>Boolean:</li>
<ul>
Stores an integer value of 0 or 1 representative of false or true respectively.
<li>Type: bool</li>
<li>Size: 1 byte</li>
</ul>
</ul>
<br>
Variables are always declared before they are initialized. This means you must determine the type and the identifier before you store any values into it.<br>
<br>
<code class="cblock"><pre>int main() {
<!-----> int a; // Declaration
<!-----> a = 1; // Initialization
<!-----> int b = 2; // Declaration then initialization
<!----->}</pre></code><br>
<br>
Constant types are variables identified by <code>const</code> in their type definition. These are not allowed to be modified after they are declared and must be initialized at declaration.
</p>
<h3 id="#basics-operators">III. Operators</h3>
<p>
Just like in mathematics, operators let you perform functions on elements. We'll start by viewing arithmetic operators and assignment.<br>
<br>
The assignment operator, denoted by <code>=</code> allows you to assign values to a variable. Assigning a variable with a value of a different type will give you a warning. This can be solved by casting the value being assigned to the same type as your variable: <code>static_cast<type>(var)</code>. Assignment also works from right to left. Values on the right of the assignment operator get assigned to the identifier on the left of the assignment operator.<br>
<br>
Arithmetic operators allow you to do operations such as addition, subtraction, multiplication, division, and remainder division.<br>
<br>
When dividing with numbers, it is important to know the type of numbers you are dividing. Division between integers will only return a whole number. For example <code>5 / 2 = 2</code>. Suppose the 5 was a floating point type then, <code>5.0 / 2 = 2.5</code>. It is important to know what types you are using when performing division.<br>
<br>
When wanting to perform division and only return the remainder, you can use the modulus operator. For example, <code>5 / 2 = 2</code> whereas <code>5 % 2 = 1</code>. 2 is the quotient and 1 is the remainder.<br>
<ul>
<li>+ Addition</li>
<li>- Subtraction</li>
<li>* Multiplication</li>
<li>/ Division</li>
<li>% Modulus</li>
</ul>
There are also ways to quickly perform arithmetic operations using "fast operators".
<ul>
<li>
Post increment/decrement:<br>
This will return the current value and then perform the operation.<br>
<code>x++</code><br>
<code>x--</code>
</li>
<li>
Pre increment/decrement:<br>
This will perform the operation, then return the current value.<br>
<code>++x</code><br>
<code>--x</code>
</li>
<br>
The following is short for <code>x = x (operation) y</code>:
<li><code>x += y</code></li>
<li><code>x -= y</code></li>
<li><code>x *= y</code></li>
<li><code>x /= y</code></li>
<li><code>x %= y</code></li>
</ul>
Next we'll approach the relational and logical operators. These allow you to evaluate comparisons between two or more variables.<br>
<br>
Relational Operators
<ul>
<li>Less than: <</li>
<li>Greater than: ></li>
<li>Less than or equal to: <=</li>
<li>Greater than or equal to: >=</li>
<li>Is equal to: ==</li>
<li>Is not equal to: !=</li>
</ul>
Logical Operators
<ul>
<li>AND: &&</li>
<li>OR: ||</li>
<li>NOT: !</li>
</ul>
When using multiple operators, it is important to know that operators have a precedence, just like in mathematics.<br>
<br>
Operators with the same precedence are evaluated in the statement from left to right.
<table>
<tr>
<th>1st</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th>Last</th>
</tr>
<tr>
<td>(a)</td>
<td>x++, x++</td>
<td>++x, --x</td>
<td>!</td>
<td>* / %</td>
<td>+ -</td>
<td>< > <= >=</td>
<td>== !=</td>
<td>&&</td>
<td>||</td>
<td>=</td>
</tr>
</table>
</p>
<h2 id="control_flow">Control Flow</h2>
<h3 id="control_flow-branchinig">I. Decision Branching</h3>
<p>
An <code>if</code> statement will execute instructions if the condition evaluates to true. You can remember this as if something is true, then my program will do this. For example:
<code class="cblock"><pre>int main() {
<!---------> int x = 1;
<!---------> if (x == 1) {
<!---------> std::cout << x << " is equal to 1.\n";
<!---------> }
<!---------> return 0;
<!--------->}</pre></code>
will execute "1 is equal to 1".<br>
<br>
An <code>if-else</code> statement will execute instructions if the condition is true and execute different instructions when the condition is false.<br><br>
<code class="cblock"><pre>int main() {
<!---------> int x = 1;
<!---------> if (x == 1) {
<!---------> std::cout << x << " is equal to 1.\n";
<!---------> }
<!---------> else {
<!---------> std::cout << x << " is not equal to 1.\n";
<!---------> }
<!---------> return 0;
<!--------->}</pre></code><br><br>
One thing to note about these types of control statements, is that they can be nested to create a decision branch. A branch, like of a tree, splits off into many smaller branches. The more nested if-else statements you have, the more and more branches you add to your decision tree.
</p>
<h3 id="control_flow-loops">II. Loops</h3>
<p>
Loops are good when you need to repeat a segment of instruction multiple times. There are a few different types of loops to be aware of.
<ul>
<li>While loop</li>
<li>Do-While loop</li>
<li>For loop</li>
</ul>
The while loop is used when the number of iterations is based on a condition that can change each time the program is run. Before the section of code within the loop body executes, first the condition must be checked. If the condition evaluates to false, the loop does not execute, similar to the if statement.
<br><br>
<code class="cblock"><pre>int main() {
<!----------> int x = true;
<!----------> while (x == true) {
<!----------> std::cout << "Hello!";
<!----------> }
<!---------->}</pre></code><br>
<br>
This while loop will run infinitively many times because x will always equal true. There is no where in this program that the value of x changes so the loop will never leave the brackets of the while loop.<br>
<br>
The do-while loop will always evaluate once. This is because, unlike the while loop, the condition is checked after the main body executes.<br>
<br>
<code class="cblock"><pre>int main() {
<!----------> int x = true;
<!----------> do {
<!----------> std::cout << "Hello!";
<!----------> } while (x == false);
<!---------->}</pre></code><br>
<br>
Note the slight change to the condition. This loop will repeat when x is false though as you can see, x is initialized to be true. However, unlike the while loop previously, this will output just one "Hello". You can see that the condition is placed after the <code>do { .. }</code> so the condition gets checked after it executes.<br>
<br>
The final type of loop is the for loop. This is used when the number of iterations of the loop is determine before the loop starts. You should not change the number of iterations after you create the loop.<br>
<br>
<code class="cblock"><pre>int main() {
<!----------> int x = true;
<!----------> for (int i = 0; i < 10; i++) {
<!----------> std::cout << "Hello!";
<!----------> }
<!---------->}</pre></code><br>
<br>
You can see here, the for loop starts at <code>i = 0</code>, checks if <code>i < 10</code>, then outputs <code>Hello!</code>. Then <code>i++ </code>executes and i increases by 1. Then the loop repeats. The loop checks if <code>i < 10</code>. i is 1 now so this is true and the program outputs <code>Hello!</code>. This repeats until <code>i < 10</code> is false which is when <code>i = 10</code>. Pretty simple stuff.
</p>
Now suppose you want to leave a loop before the condition is false or skip an iteration quickly. Then you can use the <code>break</code> and <code>continue</code> statements. <code>break</code> will BREAK out of a loop causing is to cease executing. <code>continue</code> will SKIP everthing after the continue and start back at the top of the loop.
<h3 id="control_flow-switches">III. Switch</h3>
<p>
Suppose you have a large array of if-else statements.
<code class="cblock"><pre>if (a == 1) {
<!----------> ...
<!---------->} else if (a == 2) {
<!----------> ...
<!---------->} else if (a == 3) {
<!----------> ...
<!---------->} else if (a == 4) {
<!----------> ...
<!---------->} else if (a == 5) {
<!----------> ...
<!---------->} else if (a == 6) {
<!----------> ...
<!---------->} else if (a == 7) {
<!----------> ...
<!---------->} else { ... }</pre></code>
Instead of writing that, you could've used a switch:<br>
<br>
<code class="cblock"><pre>switch (a) {
<!----------> case 1:
<!----------> ...
<!----------> break;
<!----------> case 2:
<!----------> ...
<!----------> break;
<!----------> case 3:
<!----------> ...
<!----------> break;
<!----------> case 4:
<!----------> ...
<!----------> break;
<!----------> case 5:
<!----------> ...
<!----------> break;
<!----------> case 6:
<!----------> ...
<!----------> break;
<!----------> case 7:
<!----------> ...
<!----------> break;
<!----------> default:
<!----------> ...
<!----------> break;
<!---------->}</pre></code><br>
<br>
One caveat is that the case must be a literal value. It cannot be another value. Another is that a <code>break;</code> statement must be added to the end of every case or the statements will waterfall down from the case they started at to the next break statement. This is a feature of switches.
</p>
<h3 id="control_flow-ternary">IV. Ternary Operator</h3>
<p>
The ternary operator lets you condense a simple if-else statement into one line.
<code class="cblock"><pre>x = (a > b) ? 1 : 0;</code></pre>
This means that if a is greater than b, assign x with 1. If a is not greater than b, assign x with 0. The ternary operator however needs the values in the if and else part to be of the same type. If they are not, the program will fail to compile.
</p>
<h2 id="functions">Functions</h2>
<h3 id="functions_basics">I. Basics</h3>
<p>
A function is a wrapper to easily reuse code and improve readability of your program. The function signature contains the return type, the identifier of the function, and the parameters that the function requires. The function contains statements within the curly braces. Finally, the function returns a value which has a type indicated in the function signature. Proper functions also have one intended use. If a function contains more than one use, it is a good idea to split them up.
<code class="cblock"><pre>type name (parameters) {...}</pre></code>
Functions must be defined before they are called. That is, the definition must come before any reference to using the function. A function call is done by referencing the name of the function as a statement. For example <code>my_function(1,2,3);</code> is a call to <code>my_function(int a, int b, int c) {...}</code> with the parameter values <code>a = 1, b = 2, c = 3</code>.<br>
<br>
A function which does not return anything has the type of <code>void</code>. When using a void type for a function, it is okay to omit the return statement at the end of the function. In other words, when using a void type, the return statement is optional.<br>
<br>
Functions are also essential to organized code. It can also save you time because you no longer need to rewrite or copy large blocks of code that may need to be re-used. Instead, just call the function.
</p>
<h3 id="functions_types">II. Function Types</h3>
<p>
In c++, there are three different types of function parameters.
<ul>
<li>Pass by value</li>
<ul>
<li>The data that is included in the function parameter is copied from the value of the variable that is in the argument. This creates an entirely new variable with the exact same data as the variable in the parameter. This new variable has only the scope of the function it is used in. When the function exists, this variable is destroyed.</li>
</ul>
<li>Pass by reference</li>
<ul>
<li>The address of the variable is directly associated with the variables for the local scope. That is, these local scope variables now hve access to the variables outside of the scope. This is done by using the ampersand character: <code>void my_func(int &var) {...}</code>. Essentially, these new variables contain no new data and do not take up any more memory that was already there. No matter is created, only another name for a variable which is removed after the function completes execution. The pass-by-reference parameters are called reference parameters and the arguments are called reference arguments.</li>
</ul>
<li>Constant parameters</li>
<ul>
<li>Constant types of parameters contain the <code>const</code> type for the parameters. The constant parameter can be either pass-by-value or a pass-by-reference type as well.</li>
</ul>
</ul>
<h4>Pass by value:</h4>
</p>
<h2 id="other">Other Topics</h2>
<h3 id="other_string-manipulation">String Manipulation</h3>
<p>
...
</p>
</main>
<?php include '.././snippet/footer.php'?>
</body>

16
notes/index.php Normal file
View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://lukerufkahr.com/assets/style.css">
</head>
<body>
<?php include '.././snippet/header.php'?>
<main>
<h1>List of class notes.</h1>
<ul>
<li><a href="https://lukerufkahr.com/notes/physics.html">Physics</a></li>
<li><a href="https://lukerufkahr.com/notes/circuits.html">Circuits</a></li>
<li><a href="https://lukerufkahr.com/notes/cpp.html">C++</a></li>
</ul>
</main>
<?php include '.././snippet/footer.php'?>
</body>

View File

49
notes/physics.php Normal file
View File

@@ -0,0 +1,49 @@
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="https://lukerufkahr.com/assets/style.css">
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@4.0.0/tex-mml-chtml.js"></script>
</head>
<body>
<?php include '.././snippet/header.php'?>
</header>
<main>
<h1>Physics</h1>
<h2>ToC</h2>
<ul>
<li><a href="#thermodynamics"></a></li>
<li><a href="#electromagnetism">Electromagnetism</a></li>
<ul>
<li><a href="#electromagnetism_charges-and-fields">Charges and Fields</a></li>
<li><a href="">Gauss's Law</a></li>
<li><a href="">Voltage</a></li>
<li><a href="">Capacitance</a></li>
<li><a href="">Current and Resistance</a></li>
<li><a href="">DC Circuits</a></li>
<li><a href="">Magnet Force and Fields</a></li>
<li><a href="">Sources of Magnet Fields</a></li>
<li><a href="">Electromagnetic Induction</a></li>
<li><a href="">Inductance</a></li>
<li><a href="">AC Circuits</a></li>
<li><a href="">Electromagnetic Waves</a></li>
</ul>
</ul>
<h2 id="electromagnetism">Electromagnetism</h2>
<p>
These notes are structured based on the OpenStax Physics Volume II textbook. These notes were used in coordination with the PHYS 2135 Class at Missouri University of Science and Technology
</p>
<h3 id="electromagnetism_charges-and-fields">Charges and Fields</h3>
<h3>Gauss's Law</h3>
<h3>>Voltage</h3>
<h3>Capacitance</h3>
<h3>Current and Resistance</h3>
<h3>DC Circuits</h3>
<h3>Magnet Force and Fields</h3>
<h3>Sources of Magnet Fields</h3>
<h3>Electromagnetic Induction</h3>
<h3>Inductance</h3>
<h3>AC Circuits</h3>
<h3>Electromagnetic Waves</h3>
</main>
<?php include '.././snippet/footer.php'?>
</body>

8
snippet/footer.php Normal file
View File

@@ -0,0 +1,8 @@
<footer>
<?php
$time = time();
echo "<span>The time is: $time</span>";
?>
<br>
<span>powered by debian</span>
</footer>

9
snippet/header.php Normal file
View File

@@ -0,0 +1,9 @@
<header>
<nav>
<a href="https://lukerufkahr.com">Home</a>
<a href="https://lukerufkahr.com/notes/">Notes</a>
<a href="https://lukerufkahr.com/about/">About</a>
<a href="https://lukerufkahr.com/library/">Library</a>
<a href="https://lukerufkahr.com/fun/">Fun</a>
</nav>
</header>