Skip to content

Instantly share code, notes, and snippets.

View Iboatwright's full-sized avatar

Ivan Boatwright Iboatwright

View GitHub Profile
#include <iostream>
#include <fstream>
#include <cmath>
#include <cstdlib>
using namespace std;
//Function prototypes
void getValidInput(double &, char);
void readCoeffs(double [], int);
@Iboatwright
Iboatwright / heap_test.cpp
Created March 17, 2017 23:55
testing new[] and destroy[] with struct ptr
#include <iostream>
struct equation_t
{
int coeffsCount = 3;
double coeffs[coeffsCount] = {};
int rootsCount = 2;
double roots[rootsCount] = {};
bool rootsExist = false;
};
@Iboatwright
Iboatwright / struct_testing.cpp
Last active March 16, 2017 22:48
testing some ideas for using a struct to handle arrays
#include <iostream>
using namespace std;
struct test_t {
int arr_sz = 2;
int* arr;
int var = 7;
};
// from: http://www.cplusplus.com/forum/beginner/13044/#msg62827
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
//----------------------------------------------------------------------------
template <typename T>
struct input_t
@Iboatwright
Iboatwright / IBoatwright_U4_L6.py
Last active March 22, 2016 15:54
Codecademy Python Unit 4 Lesson 6 - my solution
def hotel_cost(nights):
return 140 * nights
def plane_ride_cost(city):
costs = {"Charlotte": 183,"Tampa": 220, "Pittsburgh": 222, "Los Angeles": 475}
return costs[city]
def rental_car_cost(days):
if days >= 7:
return days * 40 - 50
@Iboatwright
Iboatwright / U4_L6.py
Last active March 22, 2016 15:53
Codecademy Python Unit 4 Lesson 6
def hotel_cost(nights):
return 140*nights
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222