Skip to content

Instantly share code, notes, and snippets.

View itsjohncs's full-sized avatar

John Sullivan itsjohncs

View GitHub Profile
#include <vector>
#include <iostream>
struct ListNode {
int data;
ListNode * next;
};
ListNode * construct_linked_list(std::vector<int> const & v) {
ListNode * head = NULL;

Problem 1

Find all of the errors in the following code. There are at least 7.

double twice(double za);
{
    return za * 2;

    if (za == 0)

Choose Your Own Adventure (Lab 4)

Write a program that walks the user through an old-style Choose Your Own Adventure (CYOA) story. An example run through of such a program is given below:

You wake up to find yourself in the entry hall of a mansion. There are two doors in the hall, one leading outside, another leads further into the mansion.

  1. Go outside
  2. Go further into the mansion

Select an option: 2

@itsjohncs
itsjohncs / ws.md
Last active January 4, 2016 03:49

Coding Zen (Lab 3)

Problem 1

Given a string of arbitrary length, how could you output only the last character of the string? Try completing the following program to test if you're correct.

#include <iostream>

using namespace std;

First Steps into C++ (Lab 2)

Problem 1

Write a program that asks the user for a number, and then rounds it down to the nearest integer before printing it out. Below is an example run of the program, bolded text is user input.

Please enter a number: 4.93
Your number is 4

Problem 2

First Steps into C++ (Week 2)

Problem 1

Find at least five syntax errors in the following code snippet.

#include iostream

int main();

SI Classroom Worksheet - Functions

Rand

Write a C++ expression that will yield a random number in each of the given ranges.

  1. 0-100
  2. 100-200
  3. -100-0
  4. -100-100

SI Classroom Worksheet

Loops

Find the values of s and n after each the following loops.

int s = 1;
int n = 1;

SI Classroom Worksheet 4

Digit Extractor

int main() {
    int num;
    cout << "Enter a number: ";
    cin >> num;
@itsjohncs
itsjohncs / resume.txt
Last active December 25, 2015 20:09
The plain text version of my resume.
# John Sullivan
Portfolio at www.johnsullivan.name
## Technologies
Here are some technologies that I have had a strong history with and
wish to work with in the future. Listed in no particular order.
* Languages: Python, C, C++, C#, JavaScript