Skip to content

Instantly share code, notes, and snippets.

@dillmo
dillmo / solve_the_global_debt.cpp
Created March 29, 2014 00:03
Solve the Global Debt Code Challeng solution
#include<iostream>
#include<cstring>
#include<vector>
#include<sstream>
#include<cstdlib>
using namespace std;
int main() {
vector<string> input, countries, output;
@dillmo
dillmo / 10.cpp
Created March 25, 2014 18:23
Intro to C++ Homework Problem Set 4 Solutions
/* Problem Set 4 Question 10 solution by Dillon Morse
* --------------------------------------------------
* Write a proram that uses nested loops to collect data and calculate the
* average rainfall over a period of years. The program should first ask for
* the number of years. The outer loop will iterate once for each year. The
* inner loops will iterate twelve times, once for each month. Each iteration
* of the inner loop will ask the user for the inches of rainfall for that
* month.
*
* After all iterations, the program should display the number of months, the
@dillmo
dillmo / test_1_lab.cpp
Created March 21, 2014 18:40
Intro to C++ Test 1 Lab Solution
/* Dillon Morse - ASD Intro to C++ Test 1 Lab Solution
* ---------------------------------------------------
* Write a program that will input an arbitrary number of people who want to
* play on a soccer team. We will not accept more than 20 applicants.
*
* Now determine how many teams of 11 people on a side can we form?
*
* Full credit requires that you handle incorrect data.
*/
@dillmo
dillmo / lab_4.cpp
Created March 7, 2014 19:59
Introduction to C++ Lab 4
/* Lab 4 Solution by Dillon Morse
* ------------------------------
* Generate four random number grades between 1 and 100. Then, drop the lowest
* grade and issue a letter grade, rounding up.
*/
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
@dillmo
dillmo / make_branches.lua
Last active August 29, 2015 13:56
A ComputerCraft program to perforate tunnel walls with lit tunnels, in order to expose ores
--[[ Branch Miner by dillmo
----------------------
Begin by placing the turtle facing forward two blocks three blocks before
the next strip. If you have already started, this is at the end of the
last strip. Next, place torches in slot one of the turtle's inventory and
cobblestone in the second. Finally, specify your preferences in
Customization and run the program. The turtle will continue until it
reaches the end of your main tunnel.
--]]
@dillmo
dillmo / 3x3_tunnel.lua
Created February 22, 2014 15:22
A ComputerCraft program to dig a lit 3x3 tunnel
-- 3x3 Tunnel by dillmo --
--[[
This program creates a 3x3 lit-up tunnel for as far as you want. To run
this program, place your turtle on the bottom row of the middle column of
your tunnel wall. Then, place torches in the turtle's first inventory
slot and cobblestone is the second slot. Before running the program, be
sure to configure the program to meet your needs.
--]]
-- Configuration --
@dillmo
dillmo / 12.cpp
Created February 21, 2014 19:26
Solutions for C++ Problem Set 3
/* Problem Set 3 Question 12 solution by Dillon Morse
* --------------------------------------------------
* A bank charges $10 per month plus the following check fees for a commercial
* checking account:
*
* $0.10 each for fewer than 20 checks
* $0.08 each for 20-39 checks
* $0.06 each for 40-59 checks
* $0.04 each for 60 or more checks
*
@dillmo
dillmo / 10.cpp
Created February 21, 2014 15:33
C++ Homework Problem Set 2 solutions
/* Problem Set 2 Question 10 by Dillon Morse
* -----------------------------------------
* Write a program that converts Celsius temperatures to Fahrenheit
* temperatures.
*/
#include<iostream>
using namespace std;
double get_celsius() {
@dillmo
dillmo / 13.cpp
Created February 21, 2014 01:23
C++ Problem Set 1
/* Homework Set 1 Problem 13 by Dillon Morse
* -----------------------------------------
* An electronics company sells circuit boards at a 40 percent profit. Write a
* program that will calculate the selling price of a circuit board that costs
* $12.67. Display the result on the screen.
*/
#include<iostream>
#include<cmath>
using namespace std;
@dillmo
dillmo / dig_a_hole.lua
Last active August 29, 2015 13:56
A ComputerCraft program to dig a hole of your desired dimensions and place ladders along the way
-- Hole Digger by dillmo --
--[[
This program will dig a hole of your description and place ladders for
you. To begin with, place your mining turtle in the bottom left corner of
your hole. Be sure to place ladders in slot one of your turtle's
inventory and specify configuration variables before beginning.
--]]
-- Configuration --
local current_height = 70 -- The current y value of your turtle. This should be