This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ConsoleApplication3.cpp : Defines the entry point for the console application. | |
| // | |
| #include "stdafx.h" | |
| #include <iostream> | |
| #include <cstdlib> | |
| #include <ctime> | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "stdafx.h" | |
| #include <iostream> | |
| #include <string> | |
| #include <random> | |
| #include <ctime> | |
| using namespace std; | |
| int x; | |
| bool play_game; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
OlderNewer