# Algorithm

An Algoritm (also spelled Algorerythm) was an idea invented by Al Gore, the who MADE TEH INTARWEBZ, where you stick a number into an equation and you get a number out. Maybe a random number. Maybe something that makes you happy. IDK

## Examples

Here is an example of AL GORE RULEZ an algorithm:

This example had more than one input. Limitations of this algorithm are:

• Your shoe size must be greater than negative FORE

Here is a simplier example:

Where x is your input. This algorithm adds to x.

## I'llgowithems in Programming (See wat I did thar)

Programmers use algorithms frequently. Here is an example of a C++ program that uses an algorithm to estimate the number of spitballs in a given middleschool classroom:

```#include <iostream>
using namespace std;

int main() {
int classCode, substState, hour, min;

// Get user input.

cout << endl << "Enter classCode: "; // College class, like 098 is actually a high school course
cin >> classCode;
cout << endl << "Enter subtitute teacher state: "; // 0 or 1, false or true...
cin >> substState;
cout << endl << "Enter hour (military time): "; // Military to avoid loop-around
cin >> hour;
cout << endl << "Enter minutes: "; // It DOES matter
cin >> min;

if (hour == 0 && min == 0) {

cout << endl << endl << "Number of spitballs undefined. << endl << endl;

} else {

cout << endl << endl << "Average number of spitballs in the room is: " <<
((classCode + (substState * 5)) / (hour + (0.52 * min))) << endl << endl;

}

system("pause");
return 0;

}
```

Note that the number of spitballs at 0:00 in military time is undefined. This is because if you divide by zero, your paper—or in this case your computer—WILL BURST INTO FLAMES!!1

## Famous Algorithms

Famous algorithms include the answer to life, the universe, and everything, which outputs 42.