Skip to content

Instantly share code, notes, and snippets.

View RyanBreaker's full-sized avatar

Ryan Breaker RyanBreaker

View GitHub Profile
//
// main.c
// LinkedList-C
//
// Created by Ryan Breaker on 5/15/16.
// Copyright © 2016 Ryan Breaker. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
enum Command {
NEW_PERSON {
final char KEY = 'P';
},
ADD_FRIEND {
final char KEY = 'A';
},
UNFRIEND {
final char KEY = 'U';
},
func isPrime(n: Int) -> Bool {
if n % 2 == 0 {
return false
}
for i in 3.stride(to: (n+1)/2, by: 2) {
if n % i == 0 {
return false
}
}
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
//
// main.cpp
// cipher
//
// Created by Ryan Breaker on 3/14/16.
// Copyright © 2016 Ryan Breaker. All rights reserved.
//
#include <fstream>
#include <iostream>
#include <string>
#include <stdio.h>
void PrintShampooInstructions(int numCycles) {
if (numCycles < 1) {
printf("Too few.\n");
return;
}
if (numCycles > 4) {
printf("Too many.\n");
package csci242.assignments.stringhandler;
import org.junit.Before;
import org.junit.Test;
import static csci242.assignments.stringhandler.StringHandlerTestHelper.*;
import static org.junit.Assert.*;
/**
* Short description.
class Vehicle {}
class Car extends Vehicle {}
ArrayList<Car> cAl = new ArrayList<>();
void stuff(ArrayList<Vehicle> al) {}
stuff(cAl); // Mismatched type?
#include <stdio.h>
#include <string.h>
char *replace_str(char *str, char *orig, char *rep)
{
static char buffer[64];
char *p;
// Is 'orig' even in 'str'?
if(!(p = strstr(str, orig)))
#include <stdio.h>
#include <stdbool.h>
char board[3][3];
char pieces[] = {'A', 'B', 'C', '1', '2', '3', 'a', 'b', 'c'};
//
void initialSetup()