Skip to content

Instantly share code, notes, and snippets.

View b-adams's full-sized avatar

Prof. Bryant E Adams b-adams

  • Wells College
  • Aurora NY
View GitHub Profile
@b-adams
b-adams / Fraction.h
Created February 6, 2012 05:11
CS132 Sp12 Program 2 Starter Files
/**
* \file Fraction.h
* \author Prof. Adams
* \brief Contains header information and documentation for Fraction object
* \version 1.0 - 120205
* \version 1.1 - 120209 - Changed at-dox to slash-dox
*/
#import <Foundation/Foundation.h>
@b-adams
b-adams / BAdamsKnife.h
Created January 25, 2012 03:51
CS132 Sp12 Acting on an Object
//
// BAdamsKnife.h
// knife_object_intro
//
// Created by Bryant Adams on 1/24/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@b-adams
b-adams / gcd.snippet.c
Created January 20, 2012 22:54
GCD functions
//Tiny function to compute the GCD
int gcd(int a, int b) { return ( b == 0 ? a : gcd(b, a % b) ); }
//More readable to return the greatest common divisor of two integers
int gcd(int first, int second)
{
if(first<0) first = -first;
if(second<0) second = -second;
if (first > second)
@b-adams
b-adams / cs322ch7flowSupplyDemand.dot
Created January 15, 2012 05:02
Wells CS322 HW Ch7b Supply/Demand problem
digraph sd2
{
s1->d1 [label="100"];
s1->d2 [label="100"];
s1->d3 [label="100"];
s1->d4 [label="100"];
s2->d2 [label="100"];
s2->d4 [label="100"];
s3->d3 [label="100"];
s3->d4 [label="100"];
@b-adams
b-adams / index.html
Created January 14, 2012 02:27
Starter homepage for Wells CS105 (HTML) class
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>[YOUR NAME HERE]'s Spring2012 CS105 Home Page</title>
<style type="text/css">
.notStarted {
visibility: hidden;
}
.inProgress:before {
@b-adams
b-adams / no_arguments.txt
Created December 7, 2011 02:53
Final Program Sample Output
eclipse:cs131 badams$ clang cs131_program_final_badams.c -o bubblesort
eclipse:cs131 badams$ ./bubblesort
Bad syntax. Instead try:
./bubblesort 3 1 4 1 5 9 2 6 5 3 5 7
Or...
./bubblesort verbose 3 1 4 1 5 9 2 6 5 3 5 7
eclipse:cs131 badams$
4/5 * 4/9 = 16/45
1/3 + 5/9 = 8/9
2/5 * 1/6 = 1/15
1/1 + 2/1 = 3/1
4/5 * 1/3 = 4/15
2/5 + 5/4 = 33/20
1/4 * 10/9 = 5/18
7/6 + 8/7 = 97/42
3/8 * 1/4 = 3/32
1/1 + 5/1 = 6/1
@b-adams
b-adams / cs228records.erl
Created November 17, 2011 21:28
Mergesort and three sort orders in Erlang, and pattern matching example
-module(cs228records).
-export([listJobbers/2]).
listJobbers(NameOfJob, [CurrentRecord | RemainingRecords]) ->
case CurrentRecord of
{person, {name, UsefulName}, {job, NameOfJob}, _} ->
[ UsefulName | listJobbers(NameOfJob, RemainingRecords)]
;
{person, {name, UselessName}, {job, RandomJob}, {Label, Data}} ->
io:format("Ignoring the <~p-~p'ed> ~p, who is a ~p.~n", [Data, Label, UselessName, RandomJob]),
@b-adams
b-adams / prog7output.txt
Created November 13, 2011 20:45
Sample output from Program 7
$ ./program_7_solution
MAIN MENU:
-----------------------------------
(a) Input data automatically
(b) Input data manually (BAD IDEA!)
-----------------------------------
(c) Display all array contents
(d) Display all contents, backward
(e) Display contents in a range
(f) Display evenly spaced contents
@b-adams
b-adams / main_and_part0.txt
Created October 30, 2011 20:36
Sample output for Program 6
Welcome to badams's Program 6
(Part 0) Welcome to the Main Menu. Please select one of the following:
0: Display this lovely menu.
1: Total some numbers
2: Display ASCII codes for letters
3: Compute some Ulam numbers, whatever those are.
-1: Quit
Whatchawannado? -2