Skip to content

Instantly share code, notes, and snippets.

View HeathGargit's full-sized avatar
😄
Welcome!

Heath Gargit (Parkes) HeathGargit

😄
Welcome!
View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IntroToCSharpTute
{
class MyClass
{
1) VS shows an error when there is more than one main function.
2) Static means the definition doesn't change. We dont want the program to change while it is running.
3) the using keyword is like the include statement in c++, it lets you use functions from other libraries and makes sure they are properly "disposed" of when the object goes out of scope.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace IntroToCSharpTute
{
class Program
@HeathGargit
HeathGargit / memex.txt
Created September 25, 2016 03:57
Pointers and Memory Exercises
1)
*p3 = S
*p3 = T, p3 = 6940
*p1 = S, p1 = 6940
3)
D
4)
Type mismatch
@HeathGargit
HeathGargit / OOD.txt
Last active June 1, 2019 03:04
Object Oriented Design Exercises
1.
Procedural is more centralised. Functions are given data to work with.
OOP puts more data into the objects. Objects primarily only work with their own data set.
2.
Abstraction: High level overview of an object.
Encapsulation: cutting off direct access to preserve data integrity
Inheritance: gaining data and attributes from parent objects
Polymorphism: changing a child object to suit it's needs more accurately.
@HeathGargit
HeathGargit / loopInputUsers.cpp
Created September 18, 2016 07:43
Structs Exercise Part 4
#include <iostream>
const int m_NameLength = 32;
struct Vector2
{
float x;
float y;
};
@HeathGargit
HeathGargit / addFunctions.cpp
Created September 18, 2016 06:27
Structs Exercise Part 3
#include <iostream>
const int m_NameLength = 32;
struct Vector2
{
float x;
float y;
};
@HeathGargit
HeathGargit / enterDetails.cpp
Last active September 18, 2016 06:18
Struct Exercises Part 2
#include <iostream>
const int m_NameLength = 32;
struct Vector2
{
float x;
float y;
};
@HeathGargit
HeathGargit / gallonsToLitres.cpp
Created September 18, 2016 04:45
Const and Typedef Exercises Part 5
#include <iostream>
const float m_LitresInAGallon = 3.78533f;
void main()
{
float inputGallons = 0;
std::cout << "Enter the number of gallons to convert to litres: ";
std::cin >> inputGallons;
@HeathGargit
HeathGargit / printHowManyTimes.cpp
Created September 18, 2016 03:48
Constants and Typedef Exercise Part 2
#include <iostream>
void printHowManyTimes()
{
static int howManyTimes = 0;
howManyTimes++;
std::cout << "I have been called " << howManyTimes << " times." << std::endl;
return;
}
void main()