Skip to content

Instantly share code, notes, and snippets.

View dmcleish91's full-sized avatar

Dwight McLeish Jr dmcleish91

View GitHub Profile
// ConsoleApplication4.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <ctime>
#include <iostream> // input output library
#include <random> // preferred C++ random library
// ConsoleApplication3.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
#include "stdafx.h"
#include <iostream>
// this is a concept showing how we can use pointers to dynamically change the size of an array
using namespace std; //this calls the standard library it makes typing somewhat easier
int *growArray(int* p_values, int cur_size); // this is declared so it can see the function after main
int main()
{
int next_element = 0; // elements in an array
#include "stdafx.h"
#include <iostream>
using namespace std;
struct newEnemy // struct is a way of storing multiple values in one variable
{
int x_position;
int y_position;
int shipattack;
#include "stdafx.h"
#include <iostream>
#include <string>
#include <random>
#include <ctime>
using namespace std;
int x;
bool play_game;
#include "stdafx.h"
#include <string> // to cout a string you need this library
#include <iostream>
using namespace std;
void setName(string *x, string *y) // this doesnt return anything it just modifies the memory address
{
*x = "Dwight";
*y = "Sucks";
#include <iostream>
using namespace std;
void change(int* x) // essential we made a new pointer and pointed it to the same address as p
{
*x = 20; // this dereferences our pointer so we can change the variable. remember this is pointing to the memory on the heap
}
int main()
#include <iostream>
#include <string>
using namespace std;
void change(string* change_first, string* change_last) // in this function we created a pointer
{
*change_first = "Master"; // this allows us to change the variable because we know its memory address
*change_last = "piece";
@dmcleish91
dmcleish91 / node.cpp
Last active September 30, 2016 01:05
// Practice.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
struct node //stores an integer and a pointer to the
{ //next node
package com.company;
public class Main {
public static void main(String[] args) {
//Default Values
double wallSpace = 115;
double gallonsOfPaint = 1;
double hoursOfLabor = 8;
double dollarCostPerHour = 20;