Skip to content

Instantly share code, notes, and snippets.

View paranoiacblack's full-sized avatar

Chris Manghane paranoiacblack

View GitHub Profile
@paranoiacblack
paranoiacblack / input1.txt
Created October 10, 2012 16:26 — forked from itsjohncs/input1.txt
CS 10 SI Classroom Session 2 - Example 1
Twix
Fido
John
Smith
47
@paranoiacblack
paranoiacblack / input1.txt
Created October 10, 2012 16:44 — forked from itsjohncs/input1.txt
CS 10 SI Classroom Session 2 - Example 2
237.87
9.52
@paranoiacblack
paranoiacblack / bad_input.txt
Created October 10, 2012 17:07
CS 10 SI Classroom Session 2 - Expression Examples
12
0
@paranoiacblack
paranoiacblack / main.cpp
Created October 11, 2012 14:10
CS 10 SI Lab Session 2 - Variable matching
#include <iostream>
using namespace std;
int main() {
// Initializing variables. '?' means you should insert the correct type
// identifier.
? a = 42;
? b = false;
? c;
@paranoiacblack
paranoiacblack / main.cpp
Created October 15, 2012 06:31
CS10 SI Classroom Session 3 - Calculator
#include <iostream>
// Remember to include cmath for math functions
#include <cmath>
using namespace std;
int main() {
// Most math functions deal with doubles so we might as well make it easy.
double leftOperand = 0.0, rightOperand = 0.0;
double result = 0.0;
@paranoiacblack
paranoiacblack / main.cpp
Created October 22, 2012 06:51
CS 10 SI Classroom Session 4 - Palindrome Testing
#include <iostream>
using namespace std;
int main() {
// In programming, a sentinel value is a special value that guarantees
// loop termination when seen. In this example, we use 'q' to represent quit.
const string SENTINEL = "q";
string userInput = "";
@paranoiacblack
paranoiacblack / annoying_validation.cpp
Created October 29, 2012 06:45
CS 10 SI Classroom Session 5 - Removing duplicated code into a function
#include <iostream>
using namespace std;
int main() {
string twoCharInput = "";
string fiveCharInput = "";
string tenCharInput = "";
// Make user continue entering word until it is the
@paranoiacblack
paranoiacblack / Makefile
Last active December 11, 2015 11:28
Class solutions to SI Lab Session 2 for CS12 Winter 2013
CXX=g++
CXXFLAGS=-g -W -Wall -Werror
OBJECTS=book.o library.o point.o rectangle.o
MAIN=main.cpp
all: $(OBJECTS)
$(CXX) $(CXXFLAGS) $(MAIN) $(OBJECTS)
rectangle.o: point.o
@paranoiacblack
paranoiacblack / main.cpp
Last active December 11, 2015 12:38
Lecture Session 3: What happens when you don't use inclusion guards?
#include "rectangle.h"
#include "point.h"
int main() {
Point p;
return 0;
}
@paranoiacblack
paranoiacblack / Makefile
Created January 25, 2013 21:17
CS12 Lab Session 3 Solution
CXX=g++
CXXFLAGS=-g -W -Wall -Werror -pedantic -ansi
OBJS=person.o
MAIN=main.cpp
all: $(OBJS)
$(CXX) $(CXXFLAGS) $(MAIN) $(OBJS) -o mytwitface
person.o: person.h person.cpp