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 "Stack.h" | |
using namespace std; | |
int main () { | |
Stack<int> s1; | |
Stack<double> s2; | |
for (int i = 0; i < 5; i++) |
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 BINARYSEARCH_H | |
#define BINARYSEARCH_H | |
template<typename T> | |
int binarySearch(T list[], T key, int size) { | |
int low = 0; | |
int high = size - 1; | |
while (high >= low) { | |
int mid = (low + high) / 2; |
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 "11_09.h" | |
#include <iostream> | |
#include <cmath> | |
using namespace std; | |
// constructors | |
Rectangle2D::Rectangle2D() { | |
setX(0); | |
setY(0); | |
setWidth(1); |
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 <string> | |
using namespace std; | |
int main () { | |
string passcode = "123"; | |
string guess; | |
bool correct = false; |
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 ANAGRAM_H | |
#define ANAGRAM_H | |
#include <string> | |
#define NO_OF_CHARS 256 | |
using namespace std; | |
bool isAnagram (const string& a, const string& b) { | |
int count[NO_OF_CHARS] = {0}; | |
int i; | |
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 <cstdio> | |
#include <string> | |
using namespace std; | |
// can't remember, do I need to include cstring? | |
void count (string input) { | |
// Setup arrays | |
char alphabet[] = "abcdefghijklmnopqrstuvwxyz"; |
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 <cmath> | |
using namespace std; | |
template<typename T> | |
T getDiff(const T a, const T b) { | |
if (a >= b) | |
return a; | |
else if (b > a) | |
return b; |
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
// init | |
pulseSquare follower = new pulseSquare(160, height/2, 50, 50, 50); | |
boolean going = true; // false is left, true is right | |
void setup() { | |
size(640, 360); | |
noStroke(); | |
ellipseMode(CENTER); | |
} |
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> | |
#include <string> | |
#include <vector> | |
#include <cstring> | |
using namespace std; | |
void write(const string &input, string oname) { | |
fstream output(oname, ios::out | ios::binary); | |
if (output.is_open()) { |
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 <fstream> | |
#include <iostream> | |
#include <ctime> | |
#include <random> | |
using namespace std; | |
int main () { | |
// create random array | |
int array[100]; |
OlderNewer