This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <iomanip> | |
#include <cmath> | |
#include <stack> | |
#include <array> | |
#include <utility> | |
#include <cstdlib> | |
#include <ctime> | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
//A queue is a FIFO (first-in-first-out data structure | |
const int SIZE = 5; | |
class QueueA { | |
private: | |
int data[SIZE]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DOG_HH_ | |
#define DOG_HH_ | |
#include <ostream> | |
class Dog { | |
private: | |
int weightLbs; | |
int ageYears; | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
struct Node { | |
int item; | |
Node* next; | |
}; | |
class LinkedList { | |
private: | |
Node* head; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//earlier in the program I run this to initialize the array | |
for (int i = 0; i < SONIC_SAMPLE * 2; i++) | |
sonicRead(); | |
//Averages and returns the inch reading of the ultrasonic sensor | |
//Updates sonicHotZone | |
SonicData robot::sonicRead() | |
{ | |
SonicData out; | |
out.avg = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://makezine.com/2014/03/24/arduino-helper-functions-2/ | |
/*Here’s some helpful functions for Arduino. | |
Blinking an LED | |
This function blinks an LED light as many times as requested, at the requested blinking rate. | |
*/ | |
void blinkLED(byte targetPin, int numBlinks, int blinkRate) { | |
for (int i=0; i < numBlinks; i++) { | |
digitalWrite(targetPin, HIGH); | |
delay(blinkRate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def checkVowels(inStr): | |
#Expects inStr to be 1 character long | |
vowels = ['A','a','E','e','I','i','O','o','U','u'] | |
for v in range(len(vowels)): | |
if inStr == vowels[v]: | |
return True | |
return False | |
def rmVowels(inStr): | |
out = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3.3 | |
import random | |
from game import * | |
deck = util.deckInit() | |
random.shuffle(deck) | |
print(deck) | |
#Creating the Pythonic equivalent of a do...while loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# Install all necessary dependencies for Debian/Ubuntu systems | |
# Install CMake GUI | |
sudo apt-get install cmake-gui | |
# SFML Dependencies | |
sudo apt-get install libpthread-stubs0-dev | |
sudo apt-get install libgl1-mesa-dev | |
sudo apt-get install libx11-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
using namespace std; | |
const int WIDTH = 2000; | |
const int HEIGHT = 300; | |
const int COLOR = 3; //0=red, 1=green, 2=blue | |
//void main(int argc, char** args[]) |