<repo_name>cjtorralba/PSU<file_sep>/Term_One/Prog_One/GPACalc.cpp

#include <iostream>
using namespace std;


/*
 * code written by <NAME> for the 3rd time cause I keep deleting it accidentally
 * first PSU assignment for Comp Sci 162, job is to calculate avg GPA
 */



double charToDouble(char c, char plus_Or_Minus); // The job of this function is to convert grade such as b- to gradePoints

int main()
{

	int totalClasses; // Total number of classes the user is taking

	char letterGrade, plusOrMinus; // the users letter grade for specified class, and if they got a +/-

	double totalGradePoints; // total amount of grade points, ex: a = 4.0, b- = 2.67

	double avgGpa; // calculated by dividing totalGradePoints by totalClasses

	char recalculate = 'y'; // setting recalculate to be 'y' at first





//      Beggining of while to ask user for grades and calculate gpa
	while(recalculate == 'y')
	{

		cout << "How many classes are you taking?" << endl;

		cin >> totalClasses;
		
		int loopCounter = totalClasses; // this is for the for() loop, in case we change the value of totalClasses
		for(int i = 1; i <= loopCounter; i++)
			{
	
				cin.ignore(100, '\n');
			
				cout << "What was the letter grade for class number "
				<< i << endl;
				cout << "Enter P if pass and F is failed for pass/fail classes" << endl;

				cin >> letterGrade;
				if(letterGrade == 'p' || letterGrade == 'f'){ --totalClasses; } // if pass or fail, wont effect gpa
				
				plusOrMinus = cin.peek();
				totalGradePoints += charToDouble(letterGrade, plusOrMinus);
								
			}

		
		avgGpa = totalGradePoints / totalClasses;

		cout << "Average GPA is: ";
		cout.precision(3);
		cout << avgGpa << endl;


		cout << "Would you like to re-calculate? <y/n>" << endl;


	//got to make sure buffer is clear before asking if user wants to retry		
		cin.ignore(100, '\n');	

		recalculate = cin.get();



	//setting all my variables back to zero in case user wants to recalculate
		avgGpa = 0.0;		
		totalClasses = 0;		
		totalGradePoints = 0.0;
		
		cin.clear();
		cin.ignore(100, '\n');

	}
return 0;
}



double charToDouble(char c, char plus_Or_Minus)
{
        double returnVal; // value of the character

        tolower(c);

        switch(c) {
                case 'a': returnVal = 4.0;
                break;

                case 'b': returnVal = 3.0;
                break;

                case 'c': returnVal = 2.0;
                break;

                case 'd': returnVal = 1.0;
                break;

                case 'f': returnVal = 0.0;
                break;

                default: 
			break;
                }

        switch(plus_Or_Minus)
                {
                        case '+': returnVal += 0.33;
                                break;
                        case '-': returnVal -= 0.33;
                                break;
                        default:
                                break;
                }
        return returnVal;
}
<file_sep>/Term_Three/prog3/derived.h
#include "base.h"

//header file with derived classes and their fucntions



//webstie class
class website : public base
{
	public:
		//constructoprs and destructors
		website();	~website();
		website(char priority, char* subject, char* link);
		website(const website& toCopy);

		void display();	//displays infromation

		void writeToFile();	//writes to fiel


	private:
		char* link;	//one data members which is the link to the website
};

//zoom meeting class
class zoom : public base
{
	public:
		//constructors and destrcutctos
		zoom();		~zoom();
		zoom(char priority, char* subject, char* teacher, char* time, char* id);
		zoom(const zoom& toCopy);

		void display();	//displays information


		void writeToFile();	//writes information tot he file
	private:
		//data members which include the teacher leading the lecture, the time the meeting starts, and the meeting id
		char* teacher;
		char* time;
		char* id;
};

//book class
class book : public base
{
	public:
		//constructors and destructos
		book();		~book();
		book(char priority, char* subject, char* pages, char* author, char* title);
		book(const book& toCopy);


		void display();	//displays information
		void writeToFile();	//writes to file

	private:
		//data members
		char* pages;
		char* author;
		char* title;
};




<file_sep>/Term_Two/Prog3/main.cpp
#include "header.h"



/*
 * This code is by <NAME> in cs163
 * main focus is to explore hash tables
 * this program allows you to enter meals you have eaten from certain establishments and they will be
 * stored into a hjash table
 * you may also remove meals and add more when you want
 * you may also display information about a certain meal if you wish
 * thanks!
 */

//These two functions are purely for ease and I made them cause i was running out of time on this project
//please do not grade me down on them I could have implemented them elsewhere it would have just taken longer
bool again()
{
	char response;
	cout << "Would you like to enter another? <y,n>" << endl;
	cin >> response;	cin.ignore(100, '\n');
	if(response == 'y')
		return true;
	return false;
}

bool type()
{
	char input;
	cout << "Is it a food cart or restaurant? <f,r>" << endl;
	cin >> input;	cin.ignore(100, '\n');

	if(input == 'c')
		return true;
	return false;
}



int main()
{
	table myTable;

	char input[100];
	char meals[50];

	meal* pmeal;

	meal first;
	first.mealName = new char[100];
	first.name = new char[100];
	first.review = new char[100];

	

	do{
		cout << "Meal name: " << endl;
		cin.get(first.mealName, 100, '\n');	cin.ignore(100, '\n');

		cout << endl << "Establishment name: " << endl;
		cin.get(first.name, 100, '\n');	cin.ignore(100, '\n');

		cout << "Review: " << endl;
		cin.get(first.review, 100, '\n');	cin.ignore(100, '\n');

		cout << "Approximate price: " << endl;
		cin >> first.price;

		cout << "Rating <1-10>: " << endl;
		cin >> first.rating;

		first.type = type();

		myTable.add(first.mealName, &first);

	}while(again());


	do
	{
		cout << "Enter r to remove a meal by the name" << endl
			<<"Enter ra to remove all meals by a certain establishment" << endl
			<< "Enter d to display a meal and its information" << endl
			<< "Enter a to add more meals" << endl;

		

		cin.get(input, 100, '\n');	cin.ignore(100, '\n');

		if(strcmp(input, "r") == 0)
		{
			cout << "Please enter the meal name" << endl;
			cin.get(meals, 100, '\n');	cin.ignore(100, '\n');

			pmeal = myTable.retrieve("meals");
			if(pmeal != NULL)
			{

				cout << "Your removed: " << endl;
				(*pmeal).display();
				pmeal = NULL;
				myTable.remove(meals);
			}
		}	
		else if(strcmp(input, "d") == 0)
		{
			cout << "Enter meal you would like to see" << endl;
			cin.get(meals, 10, '\n');	cin.ignore(100, '\n');

			if(!myTable.display(meals))
				"Looks like the meal doesn't exist yet!" << endl;




		}
		else if(strcmp(input, "a") == 0)
		{

			do{
				cout << "Meal name: " << endl;
				cin.get(first.mealName, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Establishment name: " << endl;
				cin.get(first.name, 100, '\n');	cin.ignore(100, '\n');

				cout << "Review: " << endl;
				cin.get(first.review, 100, '\n');	cin.ignore(100, '\n');

				cout << "Approximate price: " << endl;
				cin >> first.price;

				cout << "Rating <1-10>: " << endl;
				cin >> first.rating;

				first.type = type();

				myTable.add(first.mealName, &first);

				cout << "You are still adding meals" << endl;

			}while(again());

		}
		else if(strcmp(input, "ra") == 0)
		{
			cout << "Please enter the establishment name you would like to remove meals from" << endl;
			cin.get(meals, 100, '\n');	cin.ignore(100, '\n');
			cout << "Removing all meals made from: " << meals << endl;

			myTable.removeAll(meals);
		}
		else
			cout << "Not valid" << endl;






	}while(again());



	return 0;
}
<file_sep>/Term_Two/prog5_backup/class.cpp
#include "header.h"

void myClass::copy(myClass* toCopy)
{
	name = new char[strlen(toCopy->name) + 1];
	strcpy(name, toCopy->name);
}



graph::graph(int size)
{
	int i;

	list_size = size;
	list = new vertex[list_size];

	for(i = 0; i < list_size; ++i)
	{
		list[i].currentClass = NULL;
		list[i].head = NULL;
		list[i].tail = NULL;
	}
}


int graph::findLocation(char* key)
{
	int position = -1;
	int count;
	bool found = false;

	for(count = 0; count < list_size; ++count)
	{
		if(list[count].currentClass && strcmp(key, list[count].currentClass->name) == 0)
			position = count;
	}		
	return position;
}






bool graph::traverse(char* name)
{
	int current = findLocation(name);
	node* cur;

	vertex* currentVert = &list[current];

	if(list[current].head == NULL)
		cout << "Last class in this path is " << list[current].currentClass->name << endl;
	else
	{
		for(cur = list[current].head; cur != NULL; cur = cur->next)
		{
			cout << "You can take " << currentVert->currentClass->name << " after " << name << endl;
			traverse(currentVert->currentClass->name);
		}








	}	



/*
	for(i = 0; i < list_size; ++i)
	{
		if(list[i].currentClass  && (strcmp(name, list[i].currentClass->name) == 0))
		{
			cout << list[i].currentClass->name << "" << endl;
			cout << "After this you can take ";

			cur = list[i].head;
			while(cur->next != NULL)
			{
				connected = true;
				cout << "Calling traverse on " << cur->adjacent->currentClass->name << endl;
				if(cur->adjacent->currentClass)
					traverse(cur->adjacent->currentClass->name);
				cur = cur->next;
			}
			
		}


	}

*/
	return true;
}




bool graph::insertVertex(myClass* to_insert)
{
	bool inserted = false;
	int count = 0;

	while(!inserted && (count < list_size))
	{
		if(!list[count].currentClass)
		{
			inserted = true;
			list[count].currentClass = new myClass;
			list[count].currentClass->copy(to_insert);
			list[count].head = NULL;

		}
		++count;
	}
	return inserted;
}


int graph::test(int i)
{



/*	
	node* cur;
	for(int j = 0; j < list_size; ++j)
	{
		cout << list[j].currentClass->name << " at position " << j << endl;
		cur = list[j].head;
		while(cur != NULL)
		{
			cout << cur->adjacent->currentClass->name << endl;
			cur = cur->next;
		}

	}

node* cur;
k
for(cur = list[i].head; cur != NULL; cur = cur->next)
	cout << cur->adjacent->currentClass->name << endl;
if(!cur)
	cout << "WHY is this happenening" << endl;
return i;

*/



}


bool graph::insertEdge(char* name, char* connect)
{
	int current = findLocation(name);
	int attach = findLocation(connect);

	if(current == -1 || attach == -1)
		return false;
	else
	{
		if(!list[current].head)
		{
			cout << "head is NULL" << endl;	
			list[current].head = new node;
			list[current].head->next = NULL;
			list[current].head->adjacent = attach;




			cout << "Attached " << list[current].currentClass->name << " to " << list[attach].currentClass->name << endl;
			return true;
		}
		else
		{
			list[current].tail = new node;
			list[current].tail->next = NULL;
			list[current].tail->adjacent = attach;
//			list[current].tail = list[current].tail->next;

			cout << "Attached " << list[current].currentClass->name << " to " << list[attach].currentClass->name << endl;
			return true;
		}
	}






	/*

	   for(i = 0; i < list_size; ++i)
	   {
	   if(list[i].currentClass && strcmp(name, list[i].currentClass->name) == 0)
	   {
	   if(!list[i].head)
	   {
	   list[i].head = new node;
	   list[i].head->next = NULL;

	   cur = list[i].head;
	   }
	   else
	   {
	   cur = list[i].head;
	   while(cur != NULL)
	   cur = cur->next;

	   cur = new node;
	   cur->next = NULL;
	   }	

	   for(j = 0; j < list_size; ++j)
	   {
	   if(list[j].currentClass && strcmp(connect, list[j].currentClass->name) == 0)
	   {
	   cout << "connecting to " << list[j].currentClass->name << endl;
	   cur->adjacent = &list[j];
	   connected = true;
	   }
	   }
	   }
	   }
	   return connected;
	   */
}

/*
   bool graph::display()
   {
   bool full = false;
   myClass* cur;
   int i;

   for(i = 0; i < list_size; ++i)
   {
   if(list[i].currentClass)
   {
   full = true;

   cout << "Class: " << list[i].currentClass->name << endl;
   cout << "Pre Reqs: " << endl;

   cur = list[i].currentClass->head;

   while(cur->next != NULL)
   {
   cout << "\tClass: " << cur->name << endl;
   cur = cur->next;
   }

   }
   }
   return full;

   }
   */








<file_sep>/Term_Three/prog3/base.h
#include <iostream>
#include <cstring>
#include <cctype>
#include <fstream>

using namespace std;


//base class holding information that is necessary for all the children
class base
{
	public:
		base();		~base();	// constructors and destructors
		base(char* subject, char priority);
		base(const base& toCopy);

		void display();	//display function

		char getPriority(){ return priority; }	//returns the priority which is a charaxcter

		void writeToFile(ofstream& out);	//writes to file, taking a ofstream object as an argument, I dont know why but it works for some reason

	private:
		char* subject;	//subjcet of the object
		char priority;	//priority from 0-9 0 being most important
};
<file_sep>/Term_Three/prog2/derived.h
#include "base.h"



//this is the header file for all the derived classes of the base class



//swim class
class swim : public base
{
	public:
		//constructors and destructor
		swim();		~swim();
		swim(const swim & toCopy);
		swim(int length, int priority, bool group, char* name, char* location, char* swimsuit, bool member, bool hasHotTub);

		void display();	//display function

		void startExercise();	//user can se wether or not they want to work out on this trip





	private:
		char* swimSuit;	//type of swimsuit or color of swim suit, upto the user
		bool member;	//if they are a member of the pool club
		bool hasHotTub;	//if the pool has a hot tub
		bool exercise;	//true if they was to work out on this trip, false otherwise




};



//hiking class
class hike : public base
{
	public:
		//constructor and destructor
		hike();		~hike();
		hike(const hike & toCopy);
		hike(int length, int priority, bool group, char* name, char* location, bool overNight, char* season, char* weather);

		void display();	//display function

		bool rockClimb();	//prompts the user if they was to pack rock climbining shoes


	private:
		bool overNight;	//true if the hike is going to be overnight
		char* season;	//season
		char* weather;	//weather suny, rainy etc
		bool climbShoes;//true if they packed rock climbing shoes
		



};


//work class
class work : public base
{
	public:
		//work class constructor and destructor
		work();		~work();
		work(const work& toCopy);
		work(int length, int priority, bool group, char* name, char* location, char* position, int pay, bool partTime);

		void display();	//display functions

		void planLunch();	//prompts the user as to which luinch they want to pack



	private:
		char* position;	//position at work manager, floor staff etc
		double pay;	//pay per hour
		bool partTime;	//true if part time job, fals otherwise
		char* lunch;	//their lunch tehy packed


};
<file_sep>/Term_Three/prog1/node.cpp
#include "node.h"




//node constructors
node::node() : myVideo(NULL), myStream(NULL), myEmail(NULL), myEssay(NULL), next(NULL), type(-1) { }



//copy contrusctor for the node class
node::node(const node & toAdd) 	
{
	next = NULL;


	//have to set the type or else we will seg fault
	if(toAdd.myVideo)
	{
		myVideo = new video(*toAdd.myVideo);
		myStream = NULL;
		myEmail = NULL;
		myEssay = NULL;
		type = toAdd.type;

	}
	else if(toAdd.myStream)
	{
		myStream = new liveStream(*toAdd.myStream);
		myVideo = NULL;
		myEmail = NULL;
		myEssay = NULL;
		type = toAdd.type;
	}
	else if(toAdd.myEmail)
	{
		myEmail = new email(*toAdd.myEmail);
		myVideo = NULL;
		myStream = NULL;
		myEssay = NULL;
		type = toAdd.type;
	}
	else if(toAdd.myEssay)
	{
		myEssay = new essay(*toAdd.myEssay);
		myVideo = NULL;
		myEmail = NULL;
		myStream = NULL;
		type = toAdd.type;
	}
}




//recursive destructor
node::~node()
{
	delete next;

	if(myVideo)
		delete myVideo;
	else if(myStream)
		delete myStream;
	else if(myEmail)
		delete myEmail;
	else if(myEssay)
		delete myEssay;

	myVideo  = NULL;
	myStream = NULL;
	myEmail  = NULL;
	myEssay  = NULL;
	next = NULL;
}



//recursive function to add to the end of 
void node::addToEnd(node* source, node*& head)
{
	if(!head)
	{
		head = new node(*source);
		return;
	}
	addToEnd(source, head->goNext());
}


//returns the node->next of current node
node *& node::goNext()
{
	return this->next;
}



//returns type, this is necessary for 
//adding nodes to the node array in the table class
int node::getType()
{
	return type;
}



//for traversing through the linear linked list
node *& node::returnNext()
{
	return next;
}


/*
 * =========Adding our learning method objects to the nodes=======
 * 0 = video
 * 1 = liveStream
 * 2 = email
 * 3 = essay
 */


//setting our class members to a new objects using the copy constructors of each class
void node::addVideo(video& toAdd)
{
	myVideo = new video(toAdd);	
	type = 0;
}
void node::addStream(liveStream& toAdd)   
{
	myStream = new liveStream(toAdd);
	type = 1;
}
void node::addEmail(email& toAdd)  
{
	myEmail = new email(toAdd);
	type = 2;
}	
void node::addEssay(essay& toAdd)   
{
	myEssay = new essay(toAdd);
	type = 3;
}



//our display function
//this uses our type member of the node class to see if the array is NULL
bool node::displayNode()
{
	
	bool displayed = false;

	/*
	 * using switch case on our type member
	 * 0 = video
	 * 1 = liveStream
	 * 2 = email
	 * 3 = essay
	 */



	switch(type)	//using the type of object to call corresponding functions
	{
		case 0:
			myVideo->display();
			displayed = true;
			break;
		case 1:
			myStream->display();
			displayed = true;
			cout << "done " << endl;
			break;
		case 2:
			myEmail->display();
			displayed = true;
			break;
		case 3: 
			myEssay->display();
			displayed = true;
			break;

		case -1:
			break;

		default:
			break;
	}
	return displayed;
}






//=====================Table constructor and functions ====================A


//table constructor
table::table()	
{
	int i;
	size = 4;	//setting our table to size four since we only have four classes we're dealing with

	nodeTable = new node*[size];	//allocating new array of node of size N

	for(i = 0; i < size; ++i)
		nodeTable[i] = NULL;	//setting them all to NULL
}


//table destructor calls node destructor on each element
table::~table()
{
	int i;
	for(i = 0; i < size; ++i)
	{
		if(nodeTable[i])
		{
			delete nodeTable[i];
			nodeTable[i] = NULL;
		}
	}
	delete [] nodeTable;
	nodeTable = NULL;
}


//adds a node to the nodeTable array
//if the position is null we just set the first
//if it is not null we call the recursive addToEnd() function for the node
bool table::addNode(node* toAdd)
{
	int position = toAdd->getType();	//position in array


	if(position == -1)	
		return false;	//this means the node has nothing in it so we are not going to add it
	else	
	{
		//since the position is not -1, the node we want to add must exist


		if(nodeTable[position] == NULL)	//our position in the node table is empty
		{
			nodeTable[position] = new node(*toAdd);
			return true;	//our node has succefully been added
		}

		else	//our position in the node table is not empty so we need to add to the  linear linked list
		{
			nodeTable[position]->addToEnd(toAdd, nodeTable[position]);	//calling recursive function to add to the end of our linear linked list
			return true;
		}
	}
	return false;	//if it did not enter any of the blocks, it did not add the node succefully, therefore returning false
}



//These following display functions are for displaying all of any given 
//objects using their type
//
/*	for reference
 * 0 = video
 * 1 = liveStream
 * 2 = email
 * 3 = essay
 */	


void table::displayVid()
{
	node* cur;
	if(nodeTable[0])
		for(cur = nodeTable[0]; cur != NULL; cur = cur->returnNext())
		{
			cout << endl;
			cur->displayNode();
		}
}
void table::displayEmails()
{
	node* cur;
	if(nodeTable[2])
		for(cur = nodeTable[2]; cur != NULL; cur = cur->returnNext())
		{
			cout << endl;
			cur->displayNode();
		}
}
void table::displayEssays()
{
	node* cur;
	if(nodeTable[3])
		for(cur = nodeTable[3]; cur != NULL; cur = cur->returnNext())
		{
			cout << endl;
			cur->displayNode();
		}
}
void table::displayStreams()	//displaying all streams(type id = 3);
{
	node* cur;
	if(nodeTable[1])
		for(cur = nodeTable[1]; cur != NULL; cur = cur->returnNext())
		{
			cout << endl;
			cur->displayNode();
		}
}




//displays all objects and in all elements of the array
void table::displayAll()
{
	int i;
	node* cur;	//temp node for traversing throuh the list

	for(i = 0; i < size; ++i)
	{
		/*	for reference
		 * 0 = video
		 * 1 = liveStream
		 * 2 = email
		 * 3 = essay
		 */	

		if(nodeTable[i])	//if we have nodes in this element
		{			
			switch(i)	//our i counter corresponds to what type of object we are dealing with
			{
				case 0:
					cout << "Videos: " << endl;
					break;
				case 1:
					cout << "LiveStreams: " << endl;
					break;
				case 2:
					cout << "Emails: " << endl;
					break;
				case 3:
					cout << "Essays: " << endl;
					break;
			}	

			for(cur = nodeTable[i]; cur != NULL; cur = cur->returnNext())
			{
				cur->displayNode();	
				cout << endl;
			}

		}
	}
}
<file_sep>/Term_Three/prog3/derived.cpp
#include "derived.h"


//constructors and destructors
website::website() : link(NULL) {}

website::~website()
{
	if(link)
		delete [] link; link = NULL;
}


website::website(char priority, char* subject, char* link) : base(subject, priority)
{
	this->link = new char[strlen(link) + 1];
	strcpy(this->link, link);
}


website::website(const website& toCopy) : base(toCopy)
{
	if(toCopy.link)
	{
		this->link = new char[strlen(toCopy.link) + 1];
		strcpy(this->link, toCopy.link);
	}
}


//display functions displays all the data members and calls base class display function
void website::display()
{

	base::display();
	cout << "Link: " << link << endl;
	
}


//writes the information of the object to file then calls base class writeToFile()
void website::writeToFile()
{
	ofstream out;
	out.open("prog3.txt", ios::app);

	if(out)
	{
		out << "w|" << link;
		base::writeToFile(out);
	}
}


//zoom class constructors and destructors
zoom::zoom() : teacher(NULL), time(NULL), id(NULL) {}

zoom::~zoom()
{
	if(teacher)
		delete [] teacher;
	if(time)
		delete [] time;
	teacher = time = NULL;
}

zoom::zoom(char priority, char* subject, char* teacher, char* time, char* id) : base(subject, priority)
{
	this->teacher = new char[strlen(teacher) + 1];
	this->time = new char[strlen(time) + 1];
	this->id = new char[strlen(id) + 1];

	strcpy(this->teacher, teacher);
	strcpy(this->time, time);
	strcpy(this->id, id);
}

zoom::zoom(const zoom& toCopy) : base(toCopy), id(toCopy.id)
{
	if(toCopy.teacher)
	{
		this->teacher = new char[strlen(toCopy.teacher) + 1];
		strcpy(this->teacher, toCopy.teacher);
	}
	if(toCopy.time)
	{
		this->time = new char[strlen(toCopy.time) + 1];
		strcpy(this->time, toCopy.time);
	}
}



//writes the information of the object to file then calls base class writeToFile()
void zoom::writeToFile()
{

	ofstream out;
	out.open("prog3.txt", ios::app);

	if(out)
	{
		out
			<< "z|" << teacher
			<< "|" << time 
			<< "|" << id;
		base::writeToFile(out);
	}
}



//display functions displays all the data members and calls base class display function

void zoom::display()
{
	base::display();
	if(teacher && time)
		cout << "Teacher: " << teacher << endl << "Time: " << time << endl;
}


//book class construectors and destructors
book::book() : pages(NULL), author(NULL), title(NULL) {}

book::~book()
{
	if(author)
		delete [] author;
	if(title)
		delete [] title;
	if(pages)
		delete [] pages;
	title = author = pages = NULL;
}

book::book(const book& toCopy) : base(toCopy)
{
	if(toCopy.title)
	{
		this->title = new char[strlen(toCopy.title) + 1];
		strcpy(this->title, toCopy.title);
	}
	if(toCopy.author)
	{
		this->author = new char[strlen(toCopy.author) + 1];
		strcpy(this->author, toCopy.author);
	}
	if(toCopy.pages)
	{
		this->pages = new char[strlen(pages) + 1];
		strcpy(this->pages, toCopy.pages);
	}
}


book::book(char priority, char* subject, char* pages, char* author, char* title) : base(subject, priority)
{
	this->author = new char[strlen(author) + 1];
	this->title = new char[strlen(title) + 1];
	this->pages = new char[strlen(pages) + 1];

	strcpy(this->author, author);
	strcpy(this->title, title);
	strcpy(this->pages, pages);
}

//writes the information of the object to file then calls base class writeToFile()
void book::writeToFile()
{
	ofstream out;
	out.open("prog3.txt", ios::app);

	if(out)
	{
		out
			<< "b|" << pages 
			<< "|" << author 
			<< "|" << title;
		base::writeToFile(out);
	}
}




//display functions displays all the data members and calls base class display function
void book::display()
{
	base::display();
	if(author && title)
		cout << "Author: " << author << endl << "Title: " << title << endl << "Length: " << pages << " pages" << endl;

}







<file_sep>/Term_Two/prog5_backup/main.cpp
#include "header.h"

bool again()
{
	char input;
	cout << "Would you like to enter again? <y,n> " << endl;
	cin >> input;	cin.ignore(100, '\n');

	return input == 'y';
}


int main()
{

	char input;





	graph myGraph;

	myClass first;
	first.name = "cs161";

	myClass second;
	second.name = "cs162";

	myClass third;
	third.name = "cs163";

	myClass fourth;
	fourth.name = "cs202";

	myGraph.insertVertex(&first);
	myGraph.insertVertex(&second);
	myGraph.insertVertex(&third);
	myGraph.insertVertex(&fourth);

	myGraph.insertEdge("cs161", "cs162");
	myGraph.insertEdge("cs161", "cs202");
	myGraph.insertEdge("cs161", "cs163");
	
	myGraph.traverse("cs161");

	myGraph.test(0);
/*
	do
	{
		cout << "=======================" << endl;
		cout << "1: Add a class" << endl;
		cout << "2: Add a pre-req to this class" << endl;
		cout << "3: View what courses you can take after a current one" << endl;
		







	}while(again());
*/



	return 0;
}
<file_sep>/Term_Three/prog3/tree.h
#include "derived.h"
/*
 * this is oujr data structure, a tree of nodes, with each node holding an object
 * */


class node
{

	public:
		//cosntrucotr and destructor
		node();		~node();
		node(const node& toCopy);


		//adding objects to the node usign copy constructor
		void addBook(book& toAdd);
		void addWeb(website& toAdd);
		void addZoom(zoom& toAdd);

		void addNode(node& toAdd, node* root);	//add node to tree

		//to go left and rigtht in the tree
		node*& goLeft(){ return left; }
		node*& goRight(){ return right; }

		char getPriority();	//returns the priority of the specified object

		void display();		//displays node


	private:
		char id; //how we know which node holds what type of object 0 = book, 1 = website, 2 = zoom
		node* left;
		node* right;

		book* myBook;
		website* myWeb;
		zoom* myZoom;

};


class tree
{
	public:
		tree();		~tree();	//constructor

		void addNode(node& toAdd);	//add node to tree
		void display();			//display contents fo the tree
		void getFromFile();		//get information from the file

	private:
		node* root;			//root node

		void addNode(node& toAdd, node*& root);	//private recursive wrappers
		void display(node* root);

		void writeToFile();




};
<file_sep>/Term_One/prog_4/prog4.h
#include <iostream>
#include <fstream>
using namespace std;

class Question
{
	public:
		Question();
//		~Question();
		void initQuestion();
		void write();	
		void display();
	private:
	
		char* subject;
		char* body;
		char* date;


};
class List
{
	public:
		List(int length);
		//~List();
		void read();
		int lines;
	private:
		Question* fileList;
		Question* question;

};
<file_sep>/Term_Three/prog1/title.h
#include <iostream>
#include <cstring>
#include <cctype>

using namespace std;




class title
{
	public:
		//copy constructor and defauly, as well as descturcot
		title(char* name, char* date);
		title(const title & title);
		title();	~title();	
		
	//display function
		void display();

	//get/setters
		void changeTitle(char* name, char* date);
		void changeTitle(const title & toChange);
		void setTitleName(char* name);
		void setTitleDate(char* date);
		
	protected:
		char* name;	//name of title
		char* date;	//date of title
};





class video : public title	//video is a title so it conatins its member functions
{

	public:
		//constructors and destructor
		video();	~video();	
		video(char* name, char* date, char* description, double length);
		video(const video & toCopy);

		//display function
		void display();


		//functions to change members of the class
		void changeVideo(double length, char* description);
		void changeVideo(const video & toChange);


	protected:
		char* description;	//description of video
		double length;		//length of video
};

class liveStream : public video
{
	public:
		//construcotrs and desturcots
		liveStream();	~liveStream();
		liveStream(char* name, char* date, char* description, double length, char* instructor, char* topic);
		liveStream(const liveStream & toCopy);

		//change stream and display fucntions
		void changeStream(const liveStream & toChange);
		void display();



	protected:
		char* instructor;	//instructor teaching the liveStream
		char* topic;		//topic of the liveStream

};

<file_sep>/Term_Two/Prog2/header.h
#include <iostream>
#include <cctype>
#include <cstring>

using namespace std;

struct trip_section
{
	trip_section(); ~trip_section();
	bool set_trip(char* name, char* traffic, char* notes, char* landmarks, int length);
	char* name;
	char* traffic;
	char* notes;
	char* landmarks;
	int length;

	trip_section* next;
};

struct node
{
	~node();
	node* next;
	trip_section* stack;
};

class return_trip
{
	private:
		int top_index;
		const int MAX = 5;
		node* head;
	public:
		return_trip();  ~return_trip();
		bool push(trip_section* node);
		bool pop();
		trip_section* peek();
		bool display();

};



class travel
{
	private:
		trip_section* rear;
	public:
		travel();       ~travel();
		bool copy(trip_section* trip, trip_section* to_copy);
		bool enqueue(trip_section* trip_section);
		bool dequeue();
		trip_section* peek();              bool display();

};



<file_sep>/Term_One/prog5/prog5.h
#include <iostream>
#include <cstring>
#include <fstream>
using namespace std;

struct node
{
	char* name;
	char* description;
	char* complete;
	int* priority;
	node* next;
	~node();
};

class List
{
	public:
		List();	~List();

		node* getHead();	

		//void initFile();
		//bool writeToFile();

		bool add();
		bool remove(char search[]);

		void display();
		void displayPriority(int priority, node* search);

		int length();


		//bool test();
	private:
		node* head;
};
<file_sep>/Term_Three/prog1/email.cpp
#include "email.h"



//============================Email constructos and functions =======================
//
//defualt constructor
email::email() : title(), subject(NULL), body(NULL), recipiant(NULL) {}



//copy constructor, calls title copy constructor as well
email::email(const email & toCopy) : title(toCopy), timeSent(toCopy.timeSent)
{
	this->subject = new char[strlen(toCopy.subject) + 1];
	this->body = new char[strlen(toCopy.body) + 1];
	this->recipiant = new char[strlen(toCopy.recipiant) + 1];

	strcpy(this->subject, toCopy.subject);
	strcpy(this->body, toCopy.body);
	strcpy(this->recipiant, toCopy.recipiant);
}

//constructor when given information
	email::email(char* name, char* date, char* subject, char* body,  char* recipiant, double timeSent) 
: title(name, date), timeSent(timeSent)
{
	this->subject = new char[strlen(subject) + 1];
	this->body = new char[strlen(body) + 1];
	this->recipiant = new char[strlen(recipiant) + 1];

	strcpy(this->subject, subject);
	strcpy(this->body, body);
	strcpy(this->recipiant, recipiant);
}


//email destructor
email::~email()
{
	delete [] subject;
	delete [] body;
	delete [] recipiant;

	subject = body = recipiant = NULL;
}


//diaply  function to cout all the information
void email::display()
{
	title::display();
		cout << "Recipiant: " << recipiant << endl
		<< "Time sent: " << timeSent << endl
		<< "Subject: " << subject << endl
		<< "Body: " << body << endl;
}




//===============Essay constructors and functions=================


//default constructor for the essay class
essay::essay() : title(), body(NULL), dueDate(NULL), wordLength(0) { }

//constructor when given information
essay::essay(char* name, char* date, char* body, char* dueDate, int wordLength) 
: title(name, date), wordLength(wordLength)
{
	this->body = new char[strlen(body) + 1];
	this->dueDate = new char[strlen(dueDate) + 1];

	strcpy(this->body, body);
	strcpy(this->dueDate, dueDate);
}


//copy constructor
essay::essay(const essay & toCopy) : title(toCopy.name, toCopy.date), wordLength(toCopy.wordLength)
{
	body = new char[strlen(toCopy.body) + 1];
	dueDate = new char[strlen(toCopy.dueDate) + 1];

	strcpy(body, toCopy.body);
	strcpy(dueDate, toCopy.dueDate);
}

//essay class destructor
essay::~essay()
{
	delete [] body;
	delete [] dueDate;

	body = dueDate = NULL;
}


//essay display fucntion
void essay::display()
{
	title::display();
	cout << "Due date: " << dueDate << endl
		<< "Length: " << wordLength << " words" << endl
		<< "Body: " << body << endl;
}
<file_sep>/Term_Two/Prog4_Backup/main.cpp
#include "header.h"


bool again()
{
	char input;
	cout << "Again? <y,n>: ";
	cin >> input;	cin.ignore(100, '\n');
	cout << endl;

	if(input == 'y')
		return true;
	return false;
}	

int main()
{

	tree BST;

	meal myMeal;

	char name[100];
	char review[100];
	char storeName[100];
	int rating;
	int price;
	bool type;


	while(again())
	{
		cout << "Name: " << endl;
		cin.get(name, 100, '\n');	cin.ignore(100, '\n');

		cout << "Store: " << endl;
		cin.get(review, 100, '\n');	cin.ignore(100, '\n');

		cout << "Review: " << endl;
		cin.get(storeName, 100, '\n');	cin.ignore(100, '\n');


		cout << "Rating: " << endl;
		cin >> rating;	cin.ignore(100, '\n');

		cout << "Price: " << endl;
		cin >> price; 	cin.ignore(100, '\n');

		bool type = true;

		myMeal.name = name;
		myMeal.review = review;
		myMeal.storeName = storeName;
		myMeal.rating = rating;
		myMeal.price = price;
		myMeal.type = type;

		BST.add(&myMeal);

	}



	BST.display();

	BST.displayMatch("meal");


	return 0;
}
<file_sep>/Term_Two/Prog2/class.cpp
#include "header.h"





//=======================struct stuff===============================

node::~node()
{
	delete [] stack;
	next = NULL;
}


trip_section::trip_section()
{
	next = NULL;
	name = NULL;
	traffic = NULL;
	notes = NULL;
	landmarks = NULL;
	length = 0;
}


trip_section::~trip_section()
{
	delete [] name;
	delete [] traffic;
	delete [] notes;
	delete [] landmarks;
	next = NULL;
}

bool trip_section::set_trip(char* nameAdd, char* trafficAdd, char* notesAdd, char* landmarksAdd, int lengthAdd)
{
	if(this->name != NULL)
	{
		delete [] name;
		delete [] traffic;
		delete [] notes;
		delete [] landmarks;

		name = NULL;
		traffic = NULL;
		notes = NULL;
		landmarks = NULL;
	}


	name = new char[strlen(nameAdd) + 1];
	traffic = new char[strlen(trafficAdd) + 1];
	notes = new char[strlen(notesAdd) + 1];
	landmarks = new char[strlen(landmarksAdd) + 1];

	strcpy(name, nameAdd);
	strcpy(traffic, trafficAdd);
	strcpy(notes, notesAdd);
	strcpy(landmarks, landmarksAdd);
	length = lengthAdd;


	return true;	
}

//===========================End of struct stuff=========================




//===================================circular linked list stuff==========================
travel::travel()
{
	rear = NULL;
}


travel::~travel()
{
	trip_section* cur;
	trip_section* prev;

	if(rear)
	{
		if(rear->next == rear)
		{
			rear->next = NULL;
			delete rear;
			
		}
		else
		{
			cur = rear->next;
			rear->next = NULL;
			while(cur->next != NULL)
			{
				prev = cur;
				cur = cur->next;
				prev->next = NULL;
				delete prev;
			}
			rear->next = NULL;
			delete rear;
		}
	}
}



bool travel::display()
{
	trip_section* temp;

	if(!rear)
		return NULL;
	else
	{
		temp = rear;
		do
		{
			temp = temp->next;
			cout << "Name: " << temp->name << endl;
		}while(temp != rear);
		return true;
	}
	return false;
}



trip_section* travel::peek()
{
	if(!rear)
		return NULL;
	else
		return rear->next;
	return NULL;
}


bool travel::dequeue()
{
	trip_section* cur;

	if(!rear)
		return false;
	else
	{
		if(rear->next == rear)
		{
			delete rear;
			rear = NULL;
			return true;
		}
		else
		{
			for(cur = rear->next; cur->next != rear; cur = cur->next);
			cur->next = rear->next;
			delete rear;
			rear = cur;
			return true;
		}
	}
	return false;
}





bool travel::enqueue(trip_section* trip)
{

	trip_section* temp;
	if(rear == NULL)
	{
		rear = new trip_section;
		rear->next = rear;

		rear->name = new char[strlen(trip->name) + 1];
		rear->traffic = new char[strlen(trip->traffic) + 1];
		rear->notes = new char[strlen(trip->notes) + 1];
		rear->landmarks = new char[strlen(trip->landmarks) + 1];

		strcpy(rear->name, trip->name);
		strcpy(rear->traffic, trip->traffic);
		strcpy(rear->notes, trip->notes);
		strcpy(rear->landmarks, trip->landmarks);
		rear->length = trip->length;

		return true;
	}
	else
	{
		temp = rear->next;
		rear->next = new trip_section;
		rear = rear->next;
		rear->next = temp;

		rear->name = new char[strlen(trip->name) + 1];
		rear->traffic = new char[strlen(trip->traffic) + 1];
		rear->notes = new char[strlen(trip->notes) + 1];
		rear->landmarks = new char[strlen(trip->landmarks) + 1];

		strcpy(rear->name, trip->name);
		strcpy(rear->traffic, trip->traffic);
		strcpy(rear->notes, trip->notes);
		strcpy(rear->landmarks, trip->landmarks);
		rear->length = trip->length;

		return true;
	}
	return false;
}


//=========================================End of circular linked list stuff============================











//=======================================Start of stack stuff=========================================


return_trip::return_trip()
{
	top_index = 0;
	head = NULL;
}

return_trip::~return_trip()
{
	node* temp;
	if(head)
	{
		if(head->next == NULL)
		{
			delete head;
			head = NULL;
		}
		else
		{
			while(head->next != NULL)
			{
				temp = head;
				head = head->next;

				delete [] temp->stack;
				temp->next = NULL;
			}
		}
	}
}

bool return_trip::display()
{
	int temp_index = top_index;
	node* cur;

	if(!head)
		return false;
	else
	{
		for(cur = head; cur != NULL; cur = cur->next)
		{
			while(temp_index != 0)
			{
				--temp_index;
				cout << cur->stack[temp_index].name << endl;
			}		
			temp_index = MAX;
		}
		return true;
	}
	return false;
}






trip_section* return_trip::peek()
{
	if(!head)
		return NULL;
	else
		return &head->stack[top_index-1];
}

bool return_trip::pop()
{
	node* temp;
	if(!head)
		return false;
	else
	{
		if(head->next == NULL && top_index == 0)
		{
			top_index = 0;
			delete head;
			head = NULL;
			return true;
		}
		else if(top_index == 1)
		{
			top_index = MAX;
			temp = head;
			head = head->next;
			delete temp;
			return true;
		}
		else
		{
			--top_index;
			return true;
		}

	}
	return false;
}



bool return_trip::push(trip_section* trip)
{
	node* temp;

	if(!head)
	{
		head = new node;
		head->next = NULL;

		head->stack = new trip_section[MAX];

		head->stack[top_index].name = new char[strlen(trip->name) + 1];
		head->stack[top_index].traffic = new char[strlen(trip->traffic) + 1];
		head->stack[top_index].notes = new char[strlen(trip->notes) + 1];
		head->stack[top_index].landmarks = new char[strlen(trip->landmarks) + 1];

		strcpy(head->stack[top_index].name, trip->name);
		strcpy(head->stack[top_index].traffic, trip->traffic);
		strcpy(head->stack[top_index].notes, trip->notes);
		strcpy(head->stack[top_index].landmarks, trip->landmarks);
		head->stack[top_index].length = trip->length;


		++top_index;
		return true;
	}		
	else
	{
		if(top_index >= MAX)
		{
			top_index = 0;
			temp = head;
			head = new node;

			head->next = temp;	

			head->stack = new trip_section[MAX];

			head->stack[top_index].name = new char[strlen(trip->name) + 1];
			head->stack[top_index].traffic = new char[strlen(trip->traffic) + 1];
			head->stack[top_index].notes = new char[strlen(trip->notes) + 1];
			head->stack[top_index].landmarks = new char[strlen(trip->landmarks) + 1];

			strcpy(head->stack[top_index].name, trip->name);
			strcpy(head->stack[top_index].traffic, trip->traffic);
			strcpy(head->stack[top_index].notes, trip->notes);
			strcpy(head->stack[top_index].landmarks, trip->landmarks);
			head->stack[top_index].length = trip->length;

			delete temp;

			++top_index;
			return true;
		}
		else
		{

			head->stack[top_index].name = new char[strlen(trip->name) + 1];
			head->stack[top_index].traffic = new char[strlen(trip->traffic) + 1];
			head->stack[top_index].notes = new char[strlen(trip->notes) + 1];
			head->stack[top_index].landmarks = new char[strlen(trip->landmarks) + 1];

			strcpy(head->stack[top_index].name, trip->name);
			strcpy(head->stack[top_index].traffic, trip->traffic);
			strcpy(head->stack[top_index].notes, trip->notes);
			strcpy(head->stack[top_index].landmarks, trip->landmarks);
			head->stack[top_index].length = trip->length;

			delete temp;

			++top_index;
			return true;

		}

	}
	return false;
}




//===============================================End of stack stuff=====================================
<file_sep>/Term_One/prog4_backup/prog4/prog4.cpp
#include "prog4.h"		
//Question contructor, initializes all arrays to \0
Question::Question()
{
	subject[0] = '\0'; 
	questionBody[0] = '\0';
	date[0] = '\0';
}
//Compares and displays question if the date, or subject is equal to input
void Question::compare(char word[])
{
	if(strcmp(word,date) == 0 || strcmp(word, subject) == 0 || strcmp(word, "all") == 0)
		display();
}
//-----------This method uses user input to initilaize a question------------
void Question::initQuestion()
{
	cout << "Enter date please dd/mm/yyyy: ";
	cin.get(date, 11, '\n');
	cin.ignore(1000, '\n');

	cout << "Subject: ";
	cin.get(subject, 21, '\n');
	cin.ignore(1000, '\n');

	cout << "Please enter the question itself:\n";
	cin.get(questionBody, 140, '\n');
	cin.ignore(1000, '\n');
}
//----------------This method is specifically for when we are getting questions from the file-----------
void Question::initQuestion(char Date[], char Subject[], char Body[])
{
	strcpy(date, Date);
	strcpy(subject, Subject);
	strcpy(questionBody, Body);
}
//--------Displays date, subject, and quesion------------
void Question::display()
{
	cout 
		<< "\nDate: " << date
		<< "\nSubject: " << subject
		<< "\nQuestion: " << questionBody << endl;
}
//--------Writes question to file in order       date | subject | questionBody |\n 
void Question::writeToFile()
{
	ofstream out;
	out.open("question.txt", ios::app);
	if(out)
	{
		out
			<< date << "|"
			<< subject << "|"
			<< questionBody << "|\n";
	}
	else
		cerr << "Could not open or write to file..." << endl;
}


//---------Accesses question at sepcific index in the lis and runs the writeToFile method on it--------
void List::write(int index)
{
	list[index].writeToFile();
}

//Compares questions in both the regular list and fileList
void List::compare(char word[])
{
	for(int i = 0; i < arrayLength; ++i)
		list[i].compare(word);
	for(int i = 0; i < fileLength; ++i)
		fileList[i].compare(word);
}


//---------Initializes the list, with a set length for how many questions the user wants to input---
List::List(int length)
{
	list = new Question[length];
	fileList = NULL;
	arrayLength = length;
	fileLength = 0;
}
//List destructor
List::~List()
{
	delete [] list;
	delete [] fileList;
	arrayLength = 0;
	fileLength = 0;
}

//--------This initializes the list of questions to be put in by the user------------
void List::initList()
{
	int length;
	cout << "How many questions would you like to enter?" << endl;
	cin >> length;
	cin.ignore(100, '\n');

	list = new Question[length];
}
//------------This initiliazes the list of the questions from the file, should they choose to---------
void List::initFileList()
{
	ifstream in;
	in.open("question.txt");
	if(in)
		in.peek();
	else
		cerr << "Couldn't open file..." << endl;
	while(!in.eof())
	{

		char line[300];
		in.get(line, 300, '\n');
		in.ignore(300, '\n');

		if(line[0] != '\0')
			++fileLength;
	}
	//	cout << fileLength << " lines in the file..." << endl;
	fileList = new Question[fileLength];
	in.close();
	in.open("question.txt");
	for(int i = 0; i < fileLength; ++i)
	{
		char date[11];
		char subject[21];
		char body[140];

		in.get(date, 11, '|');
		in.ignore(100, '|');

		in.get(subject, 21, '|');
		in.ignore(100, '|');

		in.get(body, 140, '|');
		in.ignore(200, '\n');

		fileList[i].initQuestion(date, subject, body);
	}
}

//-----Initializes the question at whatever index you want, runs initQuestion on the question object....
void List::initQuestion(int index)
{
	list[index].initQuestion();
}



<file_sep>/Term_Three/prog1/node.h
#include "email.h"



class node
{
	public:
		//node constructors and destrucot
		node();		~node();
		node(const node & toAdd);	//copy constructos


		//functions to add learning classes to our memebers
		void addVideo(video& toAdd);
		void addStream(liveStream& toAdd);
		void addEmail(email& toAdd);
		void addEssay(essay& toAdd);

		//display the contents of a node
		bool displayNode();

		//these are used to recursivly add to the end a linked list of nodes
		//returns the next pointer
		node *& returnNext();
		node *& goNext();
		//recursivly adds to the end of a linear linked list of nodes
		void addToEnd(node* source, node *& head);

		int getType(); 	//returns the type in integer
		// this is going to be used for our table in order to add
		// nodes correctly to the array




	protected:
		//our members 
		//each node will only contain one of these, and when we are
		//done using said node
		//in main, we will destroy the node
		video* myVideo;
		liveStream* myStream;
		email* myEmail;
		essay* myEssay;

		//next pointer for the linear linked list
		node* next;

		//each node has a type, the type tells us which one of the objects above it
		//contains
		int type;	
		//for types:
		//0 = video
		//1 = livestream
		//2 = email
		//3 = essay
};



class table
{
	public:
		//constructor and destructor
		table();	
		~table();

		//addd a node to the array of nodes
		bool addNode(node* toAdd);

		//displays the contents of the entire array
		void displayAll();

		//displays all of a certain type of object
		//making use of the getType() function in the node class
		void displayVid();
		void displayEmails();
		void displayEssays();
		void displayStreams();

	protected:
		node** nodeTable;	//array of node pointers, this is 
					//what contains the linear linked list;
					//
		int size;		//size of the array, I set mine to 4 since we are only using 
					//four different objects
};
<file_sep>/Term_Three/prog2/base.h
#include <iostream>
#include <cctype>
#include <cstring>

using namespace std;



class base
{
	public:
		base();		~base();	//constructors and destructors
		base(int actLength, int priority, bool group, char* name, char* location);
		base(const base& toCopy);

		virtual void display() = 0;	//virtual functions
		virtual char* getName() { return name; }	//returns the name for easier strcmp

		int getPriority();		//returns the priority

	private:
		int activityLength;	//lenght of the activity in hours`
		int priority; 		//priority of the activity from one to ten, one being you want to do it immediatly
		bool group;		//true = is a group activity		false = not a group activity 
		char* name;		//name of the activity
		char* location;		//location of the acticity

};
<file_sep>/Term_Two/Prog4_Backup/header.h
#include <iostream>
#include <cstring>
#include <cctype>

using namespace std;

struct meal
{
	char* name;
	char* storeName;
	char* review;
	int price;
	int rating;
	bool type;

	void display(void);
	void copy(meal* to_add);
};

struct node
{
	meal myMeal;
	node* left;
	node* right;
};


class tree
{
	public:
		tree();		//~tree();
		int display(node* root);
		int display();


		int displayMatch(char* mealName);
		int displayMatch(char*mealName, node* root);

		bool add(meal* toAdd);
		bool add(meal* toAdd, node*& root);

		bool remove(node* toRemove);
		bool remove(node* toRemove, node*& root);

		bool search(char* name);




	private:
		node* root;
};
<file_sep>/Term_Three/prog2/derived.cpp
#include "derived.h"


//Swim class constructors and destructor
swim::swim() : swimSuit(NULL), member(false), hasHotTub(NULL), exercise(false) {}


//copy constructor
swim::swim(const swim& toCopy) : base(toCopy), member(toCopy.member), hasHotTub(toCopy.hasHotTub), exercise(toCopy.exercise)
{
	if(toCopy.swimSuit)
	{
		cout << "Copying swimsuit string: " << toCopy.swimSuit << endl;
		swimSuit = new char[strlen(toCopy.swimSuit) + 1];
		strcpy(this->swimSuit, toCopy.swimSuit);
	}
}

//constructor when given all the members as arguments
swim::swim(int length, int priority, bool group, char* name, char* location, char* swimSuit, bool member, bool hasHotTub) : 
	base(length, priority, group, name, location), member(member), hasHotTub(hasHotTub), exercise(false)
{
	this->swimSuit = new char[strlen(swimSuit) + 1];
	strcpy(this->swimSuit, swimSuit);
}


//swim class destructor deleting only dynamically allocated array
swim::~swim() 
{
	delete [] this->swimSuit;
	this->swimSuit = NULL;
}


//swim class functions
void swim::display()
{
	base::display();

	cout << "Swimsuit: " << swimSuit << endl;

	if(hasHotTub)
		cout << "Has a hot tub" << endl;
	else
		cout << "Does not have a hot tub" << endl;
	if(member)
		cout << "Requires membership" << endl;
	else
		cout << "Does not require membership" << endl;
	if(exercise)
		cout << "You plan to exercise on this trip" << endl;
	else
		cout << "You do not plan to exercise on this trip" << endl;
}


//prompts the user if the want to plan an exercise on this trip
void swim::startExercise()
{
	char input;

	cout << "Would you like to exercise on this trip? <y,n>: " << endl;
	cin >> input;	cin.ignore(100, '\n');
	if(input == 'y')
		exercise = true;
	else
		exercise = false;
	cout << "You can change this at any time" << endl;
}




//hike class constructors and destructor
hike::hike() : overNight(false), season(NULL), weather(NULL), climbShoes(false) {}


//hike copy constructor
hike::hike(const hike & toCopy) : base(toCopy), overNight(toCopy.overNight), climbShoes(toCopy.climbShoes)
{
	if(toCopy.season && toCopy.weather)
	{
		this->season = new char[strlen(toCopy.season) + 1];
		this->weather = new char[strlen(toCopy.weather) + 1];

		strcpy(this->season, toCopy.season);
		strcpy(this->weather, toCopy.weather);
	}
}

//hike constructor when given all members as, arguments
	hike::hike(int length, int priority, bool group, char* name, char* location, bool overNight, char* season, char* weather)
: base(length, priority, group, name, location), overNight(overNight), climbShoes(false)
{
	this->season = new char[strlen(season) + 1];
	this->weather = new char[strlen(weather) + 1];

	strcpy(this->season, season);
	strcpy(this->weather, weather);
}

//hike destrucotr deleting all dynamically allocated memory
hike::~hike()
{
	delete [] this->season;
	delete [] this->weather;

	this->season = NULL;
	this->weather = NULL;
}



//hike class functions
//displayu funtiuons
void hike::display()
{
	base::display();
	if(overNight)
		cout << "Overnight" << endl;
	else
		cout << "Day hike" << endl;
	cout << "Season: " << season << endl
		<< "Weather: " << weather << endl;

}


//prompts the user if they want to pack rock climbing shoes
bool hike::rockClimb()
{
	char input;
	if(climbShoes)
		cout << "You have packed climbing shoes" << endl;
	else
	{
		cout << "YOu have not packed climbing shoes, would you like to? <y,n>: ";
		cin >> input;	cin.ignore(100, '\n'); cout << endl;
		if(input == 'y')
			climbShoes = true;
	}
}




//work class constructors and destructor
work::work() : position(NULL), pay(-1), partTime(false), lunch(NULL) {}


//work class constructor when given the information as arguments
	work::work(int length, int priority, bool group, char* name, char* location, char* position, int pay, bool partTime)
: base(length, priority, group, name, location), pay(pay), partTime(partTime), lunch(NULL)
{
	this->position = new char[strlen(position) + 1];
	strcpy(this->position, position);
}

//work class copy constructor
work::work(const work& toCopy) : base(toCopy), pay(toCopy.pay), partTime(toCopy.partTime)
{
	if(toCopy.position)
	{
		this->position = new char[strlen(toCopy.position) + 1];
		strcpy(this->position, toCopy.position);
	}

	if(toCopy.lunch)
	{
		this->lunch = new char[strlen(toCopy.lunch) + 1];
		strcpy(this->lunch, toCopy.lunch);
	}
}
//work class destructor
work::~work()
{
	delete [] this->position;
	this->position = NULL;
}


//work class functions
//usual display fucntion
void work::display()
{
	base::display();
	cout << "Position: " << position << endl
		<< "Pay: " << pay << endl;
	if(partTime)
		cout << "Part time job" << endl;
	else
		cout << "Full time job" << endl;
	if(lunch == NULL)
		cout << "No lunch planned" << endl;
	else
		cout << "Lunch: " << lunch << endl;
}

//prompts the user for which type of lunch they would like to pack
void work::planLunch()
{
	char input;
	char lunch[30];

	cout << endl << "Would you like to pack a lunch? <y,n>: ";
	cin >> input;	cin.ignore(100, '\n');	cout << endl;

	if(input == 'y')
	{
		cout << "What would you like to pack: ";
		cin.get(lunch, 100, '\n');	cin.ignore(100, '\n');	 cout << endl;

		if(this->lunch)
		{
			delete this->lunch;
			this->lunch = new char[strlen(lunch) + 1];
			strcpy(this->lunch, lunch);
		}
		else
		{
			this->lunch = new char[strlen(lunch) + 1];
			strcpy(this->lunch, lunch);	
		}
	}
}

<file_sep>/Term_One/Prog_Two/CommonPhrase.cpp
/* code by <NAME>
 * written for cs162 programming assignment number 2
 * goal is to get common phrases from user and a signature
 * the user then can decide what order they want the phrases output in
 * ended with the users signature
 * started writing 10/21/2019 at psu library
 * my name a jeff
 */

#include <iostream> 
#include <cstring>
#include <cctype> 
using namespace std;

const int MAX_SIZE = 130;


// ------------Functions--------------------
void phraseCondition(char phrase[]); // this checks and makes sure the phrases have the correct conditions

void capSignature(char signature[]); // this makes sure the signature is capitalized

int main()
{

// -----------Variables-------------------
	const int MAX_LENGTH = 130; // Max size of the arrays
	
	char phraseOne[MAX_LENGTH], phraseTwo[MAX_LENGTH], phraseThree[MAX_LENGTH], phraseFour[MAX_LENGTH], signature[MAX_LENGTH];// all of arr character arrays set to max length
	char exitInput;// when the user wants to stop entering phrases 
	
	int numOfPhrases = 0; // total number of phrases the user has input
	int order[4]; // keeps the order of phrases
	bool exit = false, finalExit = false; // our exit conditions for bot while loops
	int phraseCount = 1; // number phrases for the switch statemenit
	cout << "Hi, the purpose of this program is to make life easier for you." << endl;
	cout << "Lets start by getting your signature please: " << endl;

	cin.get(signature, MAX_LENGTH, '\n');
	cin.ignore(150, '\n');	
//checking signature and making sure its lookin good
	capSignature(signature);
	cout << "Hello " << signature << " nice to meet you!" << endl;


//iterating through each of the phrases
while(!finalExit){
	while(!exit)
	{
		
		cout << "Please enter phrase number " << phraseCount << endl;
		
		switch(phraseCount)
		{
			case 1:
			cin.get(phraseOne, MAX_LENGTH, '\n');
			cin.ignore(100, '\n');
			phraseCondition(phraseOne);
			++numOfPhrases;
			break;

			case 2:
			cin.get(phraseTwo, MAX_LENGTH, '\n');
			cin.ignore(1000, '\n');
			phraseCondition(phraseTwo);
			++numOfPhrases;
			break;
		
			case 3:
			cin.get(phraseThree, MAX_LENGTH, '\n');
			cin.ignore(1000, '\n');
			phraseCondition(phraseThree);
			++numOfPhrases;
			break;

			case 4:
			cin.get(phraseFour, MAX_LENGTH, '\n');
			cin.ignore(1000, '\n');
			phraseCondition(phraseFour);
			++numOfPhrases;
			break;
		}
		if(phraseCount < 4)
		{
			cout << "Would you like to enter another? <y/n>: " << endl;
			cin >> exitInput;
			cin.ignore(100, '\n');
		}
		//our exit condition
		if(phraseCount == 4 || exitInput == 'n') { exit = true; phraseCount = 0; }
		++phraseCount;

	}



	cout << "What order would you like your phrases in? " << endl
		<< "Please enter numbers one at a time, followed by a return: " << endl;

	for(int i = 0; i < numOfPhrases; ++i)
	{
		cin >> order[i];
		cin.ignore(100, '\n');
	}

	for(int i = 0; i < numOfPhrases; ++i)

		switch(order[i])
		{
			case 1:
				cout << phraseOne << " ";
				break;
			case 2: 
				cout << phraseTwo << " ";
				break;
			case 3: 
				cout << phraseThree << " ";
				break;
			case 4: 
				cout << phraseFour << " ";
				break;
			default:
				break;
		}

	cout << "\n\nFrom " << signature << endl; // Adding signature to end of phrase combination.


	cout << "\n\nWould you like to run this program again? <y/n>:" << endl;
	cin >> exitInput;
	cin.ignore(100,'\n');
	if(exitInput == 'n') { finalExit = true; }
	exit = false; // setting exit condition back so user can run program again
	numOfPhrases = 0;

}
	// ------------End Program------------
	cout << "\n\nThank you for using this program!";

	return 0;


	}




// function that checks the phrase and makes sure it's valid. Also capitalizes the first character
void phraseCondition(char phrase[])
{

	int size = strlen(phrase);
	//checking that last character of phrase ends in . ! or ?
	while(phrase[size-1] != '.' && phrase[size-1] != '!' && phrase[size-1] != '\?')
	{
		cout << "Your phrase doesn't end in a valid character, please try again." << endl;

		cin.get(phrase, 130, '\n');
		cin.ignore(100, '\n');
		size = strlen(phrase); //resetting size of array to new string
	}	


	//remove double spaces and capitalize first letter
	for(int i = 0; i < size; ++i)
	{
		phrase[0] = toupper(phrase[0]);
		if(isspace(phrase[i]) && isspace(phrase[i+1]))
			for(int j = i+1; j < MAX_SIZE; ++j)
				phrase[j] = phrase[j+1];
	}
}

// this function just capitalizes our users signature
void capSignature(char signature[])
{
	int size = strlen(signature);

// remove any extra white space and capitalize letters after white space
	for(int i = 0; i < size; ++i)
		{
			if(isspace(signature[i]) && isspace(signature[i+1]))
			{
				for(int j = i+1; j < size; ++j)
					signature[j] = signature[j+1];
			}
			if(isspace(signature[i]) && isalpha(signature[i+1]))
						signature[i+1] = toupper(signature[i+1]);
		}
//capitalize first letter
	signature[0] = toupper(signature[0]);
}









<file_sep>/Term_One/prog5/prog5.cpp
#include "prog5.h"


//node destructor, recursive
node::~node()
{
	delete []name;
	delete []description;
	delete []complete;
	delete priority;
	delete next;
	name = NULL;
	description = NULL;
	complete = NULL;
	priority = NULL;
}



//List constructor, pretty straight forward
List::List()
{
	head = NULL;
}

//list destroctor, calls on head only since node 
//destrutor is recursive
List::~List()
{
	delete head;
}


//Counts how many nodes are in the LLL
int List::length()
{
	int length = 0;
	node* cur = head;
	node* prev;
	if(head == NULL)
		return 0;
	else if(head->next == NULL)
		return 1;	
	else
	{
		while(cur->next != NULL)
		{
			prev = cur;
			cur = cur->next;
			++length;
		}	

	}
	return length+1;
}





//displays each node in the LLL
void List::display()
{
	node* cur;
	if(head == NULL)
		cerr << "No List..." << endl;
	for(cur = head; cur != NULL; cur = cur->next)
	{	
		cout << "Name: " << cur->name
			<<"\nDecription: " << cur->description
			<<"\nDate to be completed by: " << cur->complete
			<< "\nPriority: " << *(cur->priority) << endl;
	}

}




//Gets the head node, this is used for a recursive function of searching
node* List::getHead()
{
	if(head ==  NULL)
	{
		return NULL;
		cerr << "Empty List..." << endl;
	}
	return head;
}



//recursivley searches for node with specific priority
//using the getHead() method
void List::displayPriority(int intSearch, node* search)
{
	if(search->next != NULL)
		displayPriority(intSearch, search->next);	
	if(*(search->priority) == intSearch)
	{
		cout << "Name: " << search->name
			<< "\nDescription: " << search->description
			<< "\nPriority: " << search->priority
			<< "\nDate to be completed: " << search->complete
			<< endl;
	}
}




//removes node with desired name...
//returns true if succesfully deleted a node
//false otherwise
bool List::remove(char search[])
{
	node* cur = head;
	node* prev;


	if(head == NULL)
	{
		cerr << "Empty List..." << endl;
		return false;
	}

	if(head->next == NULL && strcmp(head->name, search) == 0)
	{
		delete [] head->name;
		delete [] head->description;
		delete [] head->complete;
		delete  head->priority;

		head = NULL;
		cout << "Your list is now empty..." << endl;

		return true;
	}
	else
	{
		while(cur->next != NULL)
		{
			prev = cur;
			cur = cur->next;
			if(strcmp(cur->name, search) == 0)
			{
				prev->next = cur->next;
				delete [] cur->name;
				delete [] cur->description;
				delete [] cur->complete;
				delete cur->priority;

				return true;
			}
		}
	}
	cout << "Nothing matches criteria for deletion..." << endl;
	return false;
}	



//This adds a node, but it does it so that all the nodes are sorted in order based
//off name, this was hell
bool List::add()
{
	char tempName[200];
	char tempDescription[200];
	char tempComplete[100];
	int tempPriority;	


	cout << "Name of item: ";
	cin.get(tempName, 200, '\n');
	cin.ignore(200, '\n');


	cout << "\nDescription of the task: ";
	cin.get(tempDescription, 200, '\n');
	cin.ignore(200, '\n');


	cout << "\nDate you want this task completed by: ";
	cin.get(tempComplete, 100, '\n');
	cin.ignore(100, '\n');


	cout << "\nPriority <0-10>: ";
	cin >> tempPriority;
	cin.ignore(100, '\n');


	if(head == NULL)
	{
		head = new node;


		head->name = new char[strlen(tempName)+1];
		head->description = new char[strlen(tempDescription)+1];
		head->complete = new char[strlen(tempComplete)+1];
		head->priority = new int;

		strcpy(head->name, tempName);
		strcpy(head->description, tempDescription);
		strcpy(head->complete, tempComplete);
		*(head->priority) = tempPriority;

		head->next = NULL;
		return true;
	}
	else
	{
		node* cur;
		node* prev;

		if(head != NULL && head->next == NULL)
		{
			if(strcmp(tempName, head->name) >= 0)
			{
				head->next = new node;
				cur = head->next;
				cur->next = NULL;


				cur->name = new char[strlen(tempName)+1];
				cur->description = new char[strlen(tempDescription)+1];
				cur->complete = new char[strlen(tempComplete)+1];
				cur->priority = new int;

				strcpy(cur->name, tempName);
				strcpy(cur->description, tempDescription);
				strcpy(cur->complete, tempComplete);
				*(cur->priority) = tempPriority;

				return true;
			}
			else
			{
				head->next = new node;

				cur = head;
				head = head->next;
				head->next = cur;
				cur->next = NULL;

				head->name = new char[strlen(tempName)+1];
				head->description = new char[strlen(tempDescription)+1];
				head->complete = new char[strlen(tempComplete)+1];
				head->priority = new int;

				strcpy(head->name, tempName);
				strcpy(head->description, tempDescription);
				strcpy(head->complete, tempComplete);
				*(head->priority) = tempPriority;


				return true;
			}

		}

		cur = head;
		while(cur->next != NULL)
		{
			prev = cur;
			cur = cur->next;

			if(strcmp(tempName, prev->name) >= 0 && 
					strcmp(tempName, cur->name) <= 0)
			{
				prev->next = new node;
				prev = prev->next;
				prev->next = cur;


				prev->name = new char[strlen(tempName)+1];
				prev->description = new char[strlen(tempDescription)+1];
				prev->complete = new char[strlen(tempComplete)+1];
				prev->priority = new int;


				strcpy(prev->name, tempName);
				strcpy(prev->description, tempDescription);
				strcpy(prev->complete, tempComplete);
				*(prev->priority) = tempPriority;

				return true;
			}
			else if(strcmp(tempName, prev->name) <= 0 && prev == head)
			{
				head = new node;
				head->next = prev;


				head->name = new char[strlen(tempName)+1];
				head->description = new char[strlen(tempDescription)+1];
				head->complete = new char[strlen(tempComplete)+1];
				head->priority = new int;

				strcpy(head->name, tempName);
				strcpy(head->description, tempDescription);
				strcpy(head->complete, tempComplete);
				*(head->priority) = tempPriority;

				return true;
			}


			if(cur->next == NULL && strcmp(tempName, cur->name) >= 0)
			{
				cur->next = new node;
				cur = cur->next;
				cur->next = NULL;


				cur->name = new char[strlen(tempName)+1];
				cur->description = new char[strlen(tempDescription)+1];
				cur->complete = new char[strlen(tempComplete)+1];
				cur->priority = new int;

				strcpy(cur->name, tempName);
				strcpy(cur->description, tempDescription);
				strcpy(cur->complete, tempComplete);
				*(cur->priority) = tempPriority;

				return true;
			}
		}
	}
}	

/*
 * didnt have time to finish this
bool List::writeToFile(node* node)
{
	ostream out;
	out.open("ToDo.txt", ios::app);
	if(!out)
		cerr << "\n\nCould not write to file\n\n";
	else
	{
		out << node->name << "|" 
		<< node->description << "|"
		<< node->priority << "|"
		<< node->complete << "|\n";
	}

}

void List::initFile()
{
	istream in;
	in.open("ToDo.txt");

	if(!in.peek())
		cerr << "\n\nCould not read from file... \n\n";
	else
	{
		in

	}
}
*/











<file_sep>/Term_Three/prog3/base.cpp
#include "base.h"


//constructors and destructors
base::base() : subject(NULL) { }

base::~base()
{
	if(subject)
		delete [] subject;
	subject = NULL;
}

base::base(const base& toCopy) : priority(toCopy.priority)
{
	this->subject = new char[strlen(toCopy.subject) + 1];
	strcpy(this->subject, toCopy.subject);
}

base::base(char* subject, char priority) : priority(priority)
{
	this->subject = new char[strlen(subject) + 1];
	strcpy(this->subject, subject);
}


//displays information in the base class
void base::display()
{
	if(subject)
		cout << "Subject: " << subject << endl;
	cout << "Priority: " << priority << endl;

}

//writes to the given ofstream file
void base::writeToFile(ofstream& out)
{
	if(out)
	{
		out 
			<< "|" << subject 
			<< "|"  << priority << "|\n";
	}
	else
		cerr << "Couldnt write to file" << endl;
}

<file_sep>/Term_One/Prog_Three/prog3.cpp
/* Code by <NAME>...assignment number 3 for CS162
 * purpose of this program is toask the user to input questions they want to store later to practice
 * this mainly uses structures and functions to display the structures, creating them locally from the text file
 */


#include <iostream>
#include <cctype>
#include <cstring>
#include <fstream>
using namespace std;
//------------Constants-----------
const int SUBSIZE = 21; // size for array of characters thta holds subject, e.g., loops, arrays, structs
const int QUESTSIZE = 140; // Constant for size of question
//--------Structs------
struct Question{
	char subject[SUBSIZE]; // this is the subject of our question, loops, stucts, files, etc...
	char questionText[QUESTSIZE];// this is the acutal question itself
	char date[11]; //dates are usually a set size already..
};


//------Prototypes--------
//functions explained where they are written 
//prototypes are pretty stright forward
void writeToFile(Question & question);
void createStruct(Question &list);
void displayQuestion(char subject[]);
void getQuestionStruct(char subject[]);
void displayStruct(Question & question);
void displayStructQuestion(Question & question);//for testing only...
//--------Fuctions---------
int main()
{
	int numOfQuestions;//numbers of questions the user wants to input, required for our for loop
	Question list[numOfQuestions];//our array of questions, 
	bool endProg = true;
	//------Getting how many questions the user wants to enter-------
	cout << "How many questions would your like to input?" << endl;
	cin >> numOfQuestions;
	cin.ignore(100, '\n');
	while(numOfQuestions > 10)
	{
		cout << "Please put in a number that is 10 or less..." << endl;
		cin >> numOfQuestions;
		cin.ignore(100, '\n');
	}

	for(int i = 1; i <= numOfQuestions; ++i)
	{
		cout << "Creating problem " << i << endl;
		createStruct(list[i]);
		writeToFile(list[i]);
	}
	//---------------------------------------------------------------

	//--------This is the loop where the user is asked what questions they want to see---
	while(endProg)
	{

		cout << "Which questions do you want to see? \nEnter a date, subject, or \"all\"" << endl;
		char subject[30];
		cin.get(subject, 30, '\n');
		getQuestionStruct(subject);
		cout << "Do you want to see more questions? <y/n>" << endl;
		char input;
		cin >> input;
		cin.ignore(100, '\n');
		if(input == 'n')
			endProg = false;
	}
	cout << "Thanks for using the program!" << endl;
	return 0;
}

//this function is called in our for loop and edits the desired struct at the current index
void createStruct(Question & list)
{

	cout << "What is the subject: ";
	cin.get(list.subject, SUBSIZE, '\n');
	cin.ignore(100, '\n');

	cout << "What is the date you are writing this: ";
	cin.get(list.date, 11, '\n');
	cin.ignore(100,'\n');

	cout << "Please enter the question now: " << endl;
	cin.get(list.questionText, QUESTSIZE, '\n');
	cin.ignore(QUESTSIZE, '\n');
}


//This displays the quetion by passing in the current struct that contains a question
void displayStruct(Question & question)
{
	if(question.date[0] != '\0')
	{
		//cout << strlen(question.date) << endl;
		cout << "\nDate: " << question.date
			<< "\nSubject: " << question.subject
			<< "\nQuestion: " << question.questionText << endl;
	}
}

//this just displays question text for testing purposes
void displayStructQuestion(Question & question)
{
	cout << question.questionText << endl << endl;
}



//Much more improved way of getting the question from text file,
//done by creating a struct of the question on that line, then displaying it if 
//it matches a set criteria
void getQuestionStruct(char subject[])
{
	Question question;// the local struct we will be using to display the questions
	ifstream infile;
	infile.open("question.txt");
	if(infile)
		infile.peek();
	else
		cerr << "Couldn't open file..." << endl;
	while(!infile.eof())
	{
		infile.get(question.date, 11, '|');
		infile.ignore(1000, '|');

		infile.get(question.subject, 100, '|');
		infile.ignore(1000, '|');

		infile.get(question.questionText, QUESTSIZE, '|');
		infile.ignore(1000, '\n');
		if(strcmp(subject, question.subject) == 0 || strcmp(subject, question.date) == 0 
				|| strcmp(subject, "all") == 0)
			displayStruct(question);
	}



}

//This is our function that writes our desired question to our test file
//does it in the order of        "| Date | Subject | Body of question | \n"
void writeToFile(Question & question)
{
	ofstream out;

	out.open("question.txt", ios::app);
	if(out)
	{
		//cout << "Connected to file... " << endl;
		//cout << "Order will be | Date | Subject | Body of question | " << endl;		
		out 
			<< question.date << "|"
			<< question.subject << "|"
			<< question.questionText << "|\n";
	}
	else
		cerr << "Error writing to file..." << endl;
	out.close();
	out.clear();
}







//Don't even look at this it's not worth your time...

/*      VERY LOW IQ VERSION OF GETTING SHIT FROM THE FILE...... works like 35% of the time
 *      this was a horrible way and it should never be used -_-
 void displayQuestion(char subject[])
 {	
 char date[11];
 char compare[30];
 char question[QUESTSIZE];
 ifstream infile;
 infile.open("question.txt");
 if(infile)
 {
 infile.peek();
//cout << "Date:" << date << endl;
//infile.ignore(100, '|');
}
else
cerr << "Trouble reading from file..." << endl;
//int count = 0;
while(!infile.eof())
{
//cout << count << endl;
infile.get(compare, 31, '|');
infile.ignore(100, '|');
cout << "Our compare string: " << compare << endl;
//cout << "What we want our compare to be: " << subject << endl;
if(strcmp(subject, compare) == 0)
{
cout << "Key: " << subject << endl << "Compare: " << compare << endl;
//infile.ignore(100, '|');
infile.get(question, QUESTSIZE, '|');	
infile.ignore(100, '|');
cout << "Our question: " << question << endl;
}
//++count;
}

}
*/






















<file_sep>/Term_One/prog_4/main.cpp
#include <iostream>
#include "prog4.h"
int main()
{
	int questions;
	cout << "How many questions would you like to enter?" << endl;
	cin >> questions;
	cin.ignore(100, '\n');

	List list(questions);
	for(int i = 0; i < questions; ++i)
	{
		list.question[i].initQuestion();
		list.question[i].display();
	}
	return 0;
}
<file_sep>/Term_Two/prog5_backup/header.h
#include <iostream>
#include <cstring>
#include <cctype>

using namespace std;


struct vertex
{
	struct myClass* currentClass;

	struct node* head;	
	struct node* tail;
};

struct node
{
	int adjacent;
	node* next;
};

struct myClass
{
	char* name;
//	myClass* next;	// this is the list of required classes for any given class
	void copy(myClass* to_copy);
};

class graph
{

	public:
		graph(int size = 10);	//~graph();
		bool insertVertex(myClass* to_insert);
		bool insertEdge(char* name, char* connect);
//		bool display(void);
		int test(int i);
		bool traverse(char* name);
		int findLocation(char* key);

	private:
		vertex* list;
		int list_size;


};
<file_sep>/Term_Three/prog2/list.cpp
#include "list.h"

//node class constructor taking the arrsize as an argument
node::node(int arrSize) : next(NULL), arrSize(arrSize)
{
	data = new base*[arrSize];
	for(int i = 0; i < arrSize; ++i)
		data[i] = NULL;
}

//noed class desturctos
node::~node()
{
	delete next;

	int i;
	for(i = 0; i < arrSize; ++i)
	{
		if(data[i])
		{
			delete data[i];
			data[i] = NULL;
		}
	}
}


//function for deleting a base class pointer using a name to match
bool node::deleteBase(char* match)
{
	int i;
	bool removed = false;

	for(i = 0; !removed && i < arrSize; ++i)
	{
		if(data[i] && strcmp(match, data[i]->getName()) == 0)
		{
			delete data[i];
			data[i] = NULL;
			removed = true;
		}
	}
	return removed;
}


//returns first matching base class pointer of the matching name
base* node::getNodeByName(char* name)
{
	bool found = false;
	base* temp = NULL;
	int i;

	for(i = 0; !found && i < arrSize; ++i)
	{
		if(data[i] && strcmp(name, data[i]->getName()) == 0)
		{
			found = true;
			temp = data[i];
		}
	}
	return temp;
}


//displays all elements in the array
void node::displayAll()
{
	for(int i = 0; i < arrSize; ++i)
		if(data[i] != NULL)
		{
			data[i]->display();
			cout << endl;
		}
}


//returns the priority of the element in given position
int node::getPriority(int position)
{
	return data[position]->getPriority();	
}


//returns if the last element is null in the list
bool node::isFull()
{
	return !(data[arrSize-1] == NULL);
	//if the last element in the array is not NULL then the array is full
}

//returns next pointer
node*& node::goNext()
{
	return next;
}


//adds a swim class
void node::addSwim(swim* toAdd)
{
	int i;
	bool inserted = false;
	for(i = 0; !inserted && i < arrSize; ++i)
	{
		if(data[i] == NULL)
		{
			data[i] = new swim(*toAdd);
			inserted = true;
		}
	}
}

//adds a work class
void node::addWork(work* toAdd)
{
	int i;
	bool inserted = false;

	for(i = 0; !inserted && i < arrSize; ++i)
	{
		if(data[i] == NULL)
		{
			data[i] = new work(*toAdd);
			inserted = true;
		}
	}
}

//adds a hiking class1
void node::addHike(hike* toAdd)
{
	int i;
	bool inserted = false;
	for(i = 0; !inserted && i < arrSize; ++i)
	{
		if(data[i] == NULL)
		{
			data[i] = new hike(*toAdd);
			inserted = true;
		}
	}
}


//returns the poitners at n position in the array
base*& node::getPosition(int position)
{
	return this->data[position];
}



//chose 5 as size of our arrays just because
list::list() : arrSize(5), head(NULL), tail(NULL) {}


//list detructor
list::~list()
{
	if(head)
		delete head;
	head = NULL;
	tail = NULL;

}


//function to delete a base class pointer form the LLL
bool list::deleteBase(char* match)
{
	node* cur;
	bool removed = false;

	if(head)
		for(cur = head; !removed && cur != NULL; cur = cur->goNext())
			removed = cur->deleteBase(match);
}


//returns first matching base pointer with name
base* list::getNodeByName(char* name)
{
	bool found = false;
	node* cur;
	base* toReturn = NULL;

	if(!head)
		return NULL;
	else
	{
		for(cur = head; !found && cur != NULL; cur = cur->goNext())
		{
			toReturn = cur->getNodeByName(name);
			if(toReturn != NULL)
				found = true;
		}
	}

	return toReturn;
}


//displays all nodes
void list::display()
{
	if(head)
	{
		for(node* cur = head; cur != NULL; cur = cur->goNext())
			cur->displayAll();
	}
}


//adds a swim object
void list::addSwim(swim* toAdd)
{

	if(!head)	//head is null so there is no data anywhere
	{
		head = new node(arrSize);
		head->addSwim(toAdd);
	}

	else if(head->isFull())
	{
		node* temp = head;
		head = new node(arrSize);

		head->goNext() = temp;

		head->addSwim(toAdd);

	}
	else
		head->addSwim(toAdd);


}


//adds a hike object
void list::addHike(hike* toAdd)
{

	if(!head)	//head is null so there is no data anywhere
	{
		head = new node(arrSize);
		head->addHike(toAdd);
	}

	else if(head->isFull())
	{
		node* temp = head;
		head = new node(arrSize);

		head->goNext() = temp;

		head->addHike(toAdd);

	}
	else
		head->addHike(toAdd);



}


//adds a work object
void list::addWork(work* toAdd)
{
	if(!head)	//head is null so there is no data anywhere
	{
		head = new node(arrSize);
		head->addWork(toAdd);
	}

	else if(head->isFull())
	{
		node* temp = head;
		head = new node(arrSize);

		head->goNext() = temp;

		head->addWork(toAdd);

	}
	else
		head->addWork(toAdd);
}


<file_sep>/Term_One/prog4/main4.cpp
/* Code by <NAME>
 * program assignment number 4 for cs162
 * this program is an object oriented version of program number 3
 * purpose is to get practice questions you may want to use in the future
 * and store them into a file, then you may request specific questions
 */







#include "prog4.h"
using namespace std;

int  main()
{

	char input[21]; //our inputfor questions the user wants to get
	int count;  //what we will be initializing the array of questions to
	char viewFile, exitVal; //if they want to view questions in the file or not, and an exit statement for main loop
	bool exit; //our exit boolean for main loop
	List list; // our list object


	cout << "How many questions do you want to enter: " << endl;
	cin >> count;
	cin.ignore(100, '\n');
	list.init(count); //Initializing list to count size
	for(int i = 0; i < count; ++i)	
	{
		list.initQuestion(i);
		list.write(i);
	}

	cout << "Would you like to access the questions in the file too? <y/n>" << endl;
	cin >> viewFile;
	cin.ignore(100, '\n');
	if(viewFile == 'y')
		list.initFileList();


	exit = list.hasQuestions();//checking to see if either list even has questions

	if(!list.hasQuestions())
		cout << "No quetions to display! Please run again and enter some..." << endl;


	while(exit)
	{
		cout << "What question do you want to see, enter a date, subject, or \"all\" to display all questions. " << endl;
		cin.get(input, 21, '\n');
		cin.ignore(1000, '\n');
		list.compare(input);
		cout << "\nWould you like to see more questions? <y/n>" << endl;
		cin >> exitVal;
		cin.ignore(100, '\n');
		if(exitVal == 'n')
			exit = false;	
	}
	//	delete list;	

	cout << "\nThank you for running the program..." << endl;

	return 0;
}
<file_sep>/Term_Three/prog1/title.cpp
#include "title.h"

//====================Title functions and contructors================================

title::title() : name(NULL), date(NULL)	{} 	//constructor with no data given to us so we will set it to NUL


//constructor when we are given the information via arguments
title::title(char* name, char* date)
{
	this->name = new char[strlen(name) + 1];
	this->date = new char[strlen(date) + 1];

	strcpy(this->name, name);
	strcpy(this->date, date);
} //constructor when we are given the data we need to work with

title::title(const title & toCopy) 	//copy constructor
{
	if(toCopy.name)
	{
		name = new char[strlen(toCopy.name) + 1];
		strcpy(name, toCopy.name);
	}
	if(toCopy.date)
	{
		date = new char[strlen(toCopy.date) + 1];
		strcpy(date, toCopy.date);
	}
}


//title destructor destroys dynamic memebersj
title::~title()
{
	delete [] name;
	delete [] date;

	name = NULL;
	date = NULL;
}

//display functions displays the name and date
void title::display()
{
	if(name)
		cout << "Name: " << name << endl;		
	if(date)
		cout << "Date: " << date << endl;
}

//a change title function 
//I will probably not include this in main

void title::changeTitle(char* name, char* date)
{
	if(this->name)	//checking to see if the name has already been set first
	{
		delete [] this->name;
		this->name = new char[strlen(name) + 1];
		strcpy(this->name, name);
	}
	else
	{
		this->name = new char[strlen(name) + 1];
		strcpy(this->name, name);
	}

	if(this->date)	//checking to see if the date has been set already
	{

		delete [] this->date;
		this->date = new char[strlen(date) + 1];
		strcpy(this->date, date);
	}
	else
	{
		this->date = new char[strlen(date) + 1];
		strcpy(this->date, date);
	}
}


void title::changeTitle(const title & toChange)
{
	if(this->name)	//checking to see if the name has already been set first
	{
		delete [] this->name;
		this->name = new char[strlen(toChange.name) + 1];
		strcpy(this->name, toChange.name);
	}
	else
	{
		this->name = new char[strlen(toChange.name) + 1];
		strcpy(this->name, toChange.name);
	}

	if(this->date)	//checking to see if the date has been set already
	{

		delete [] this->date;
		this->date = new char[strlen(toChange.date) + 1];
		strcpy(this->date, toChange.date);
	}
	else
	{
		this->date = new char[strlen(toChange.date) + 1];
		strcpy(this->date, toChange.date);
	}
}


void title::setTitleName(char* name)
{
	if(this->name && name)	//checking to see if the name has already been set first
	{
		delete [] this->name;
		this->name = new char[strlen(name) + 1];
		strcpy(this->name, name);
	}
	else if(!this->name && name)
	{
		this->name = new char[strlen(name) + 1];
		strcpy(this->name, name);
	}
}

void title::setTitleDate(char* date)
{
	if(this->date)	//checking to see if the date has been set already
	{

		delete [] this->date;
		this->date = new char[strlen(date) + 1];
		strcpy(this->date, date);
	}
	else
	{
		this->date = new char[strlen(date) + 1];
		strcpy(this->date, date);
	}
}





//=================================Video function and constructors==================================



//default constructor
video::video() : description(NULL) {}

//constructor when we are given the information via arguments
video::video(char* name, char* date, char* description, double length) : title(name, date), length(length) 
{
	this->description = new char[strlen(description) + 1];
	strcpy(this->description, description);
}

//copy constructor calls title copy contructor as well using
//initialization list
video::video(const video & toCopy) : title(toCopy)
{
	description = new char[strlen(toCopy.description) + 1];
	strcpy(description, toCopy.description);

	length = toCopy.length;
}	

//video destructor
video::~video()
{
	delete [] description;
	description = NULL;
}


//display function calls title display function and 
//also displays description and length
void video::display()
{
	title::display();
	cout << "Description: " << this->description << endl << 
		"Length: " << this->length << endl;
}


//====================Live stream functions and constructors==============================

//default constructor
liveStream::liveStream() : video(), instructor(NULL), topic(NULL) { }

//copy contructor calls parent copy constructor for parent members
liveStream::liveStream(const liveStream& toCopy) : video(toCopy)
{
	this->instructor = new char[strlen(toCopy.instructor) + 1];
	this->topic = new char[strlen(toCopy.topic) + 1];

	strcpy(this->instructor, toCopy.instructor);
	strcpy(this->topic, toCopy.topic);
}


//constructor when we are given the information
liveStream::liveStream(char* name, char* date, char* description, double length, char* instructor, char* topic) 
	: video(name, date, description, length)
{
	this->instructor = new char[strlen(instructor) + 1];
	this->topic = new char[strlen(topic) + 1];

	strcpy(this->instructor, instructor);
	strcpy(this->topic, topic);
}

//destructor
liveStream::~liveStream()
{
	delete [] instructor;
	delete [] topic;

	instructor = NULL;
	topic = NULL;
}


//display function where we call parents display which in turn calls
//the title display function as well
void liveStream::display()
{
	video::display();

	cout << "Instructor: " << this->instructor << endl
		<< "Topic: " << this->topic << endl;

	cout << "Done displaying stream" << endl;
}


<file_sep>/Term_Three/prog1/main.cpp
#include "node.h"


/*
 * program one by <NAME> for cs202 at PSU
 * this program is to experiment with the use of classes and inheritance, 
 * we have developed classes to represent different types of learning, whether it be a video, livestream, or essay
 *
 * to store these classes we have made use of an array of linear linked lists to try to make it more efficent, each 
 * element in the array contains a pointer to a list of like objects
 */


//just a simple function to check if the user want to continue
bool again()
{
	char input;
	cout << "Again? <y,n>:";
	cin >> input;
	cout << endl;
	return input == 'y';
}

int main()
{

	table LLL;	//our data structure;
	
	//variables for adding specific objects to nodes
	video* vid;
	email* myEmail;
	liveStream* stream;
	essay* myEssay;

	node* toAdd;	//node we will be using to add to the table;

	int input;	//user input

//variable for the title class
	char name[50];
	char date[50];

//variables for the video class
	char desc[100];
	double length;

//variables for the liveStream class
	char instructor[50];
	char topic[100];

//variables for the email class
	char subject[100];
	char body[800];
	char sender[50];
	char recipiant[50];
	double timeSent;

//variables for the essay class
	char paper[1200];
	char dueDate[20];
	int wordLength;



	do
	{
		cout << "Please enter corresponding to below: " << endl
			<< "1: Add a new video" << endl
			<< "2: Add a new livestream" << endl
			<< "3: Add a new Email" << endl
			<< "4: Add a new essay" << endl
			<< "5: Display all videos" << endl
			<< "6: Display all livestreams" << endl
			<< "7: Display all emails" << endl
			<< "8: Display all essays" << endl
			<< "9: Display everything" << endl

		cin >> input;	cin.ignore(100, '\n');

		switch(input)
		{
			/*
			 * when adding to our table, we allocated a new object of requested type and call the copy constructor on it to copy its contents into 
			 * the array
			 *
			 * when the contents have been copied, we de allocate it and set it to null so we can re use the pointer
			 */


			case 1: 
				cout << "Name: ";
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Date: ";
				cin.get(date, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Description of the video: ";
				cin.get(desc, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Length (minutes): ";
				cin >> length;			cin.ignore(100, '\n');

				vid = new video(name , date, desc, length);
				toAdd = new node();

				toAdd->addVideo(*vid);


				LLL.addNode(toAdd);



				delete vid;
				delete toAdd;

				vid = NULL;
				toAdd = NULL;

				break;
			case 2:
				
				cout << "Name: ";
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Date: ";
				cin.get(date, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Description of the video: ";
				cin.get(desc, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Length (minutes): ";
				cin >> length;			cin.ignore(100, '\n');

				cout << endl << "Instructor: ";
				cin.get(instructor, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Topic: ";
				cin.get(topic, 100, '\n');	cin.ignore(100, '\n');

				stream = new liveStream(name, date, desc, length, instructor, topic);

				toAdd = new node();


				toAdd->addStream(*stream);

				
				LLL.addNode(toAdd);

				delete stream;
				delete toAdd;

				stream = NULL;

				toAdd = NULL;

				break;


			case 3:
				cout << "Name: ";
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Date: ";
				cin.get(date, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Recipiant: ";
				cin.get(recipiant, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Subject: ";
				cin.get(subject, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Body: ";
				cin.get(body, 800, '\n');	cin.ignore(800, '\n');

				cout << endl << "Time sent: ";
				cin >> timeSent;		cin.ignore(100, '\n');

				toAdd = new node();

				myEmail = new email(name, date, recipiant, subject, body, timeSent);
				
				toAdd->addEmail(*myEmail);

				LLL.addNode(toAdd);

				delete myEmail;
				delete toAdd;

				myEmail = NULL;
				toAdd = NULL;

				break;

			case 4:
				cout << endl << "Name: ";
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Date: ";
				cin.get(date, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Due Date: ";
				cin.get(dueDate, 100, '\n');	cin.ignore(100, '\n');

				cout << endl << "Body: ";
				cin.get(paper, 1200, '\n');	cin.ignore(1200, '\n');

				cout << endl << "Word Length: ";
				cin >> wordLength;		cin.ignore(100, '\n');

				myEssay = new essay(name, date, paper, dueDate, wordLength);

				toAdd =  new node();

				toAdd->addEssay(*myEssay);

				LLL.addNode(toAdd);

				delete toAdd;
				delete myEmail;

				toAdd = NULL;
				myEmail = NULL;

				break;


			 // switch cases for displaying certain sets of objects

			 case 5:
				LLL.displayVid();
				break;
			 case 6:
				LLL.displayStreams();
				break;
			 case 7:
				LLL.displayEmails();
				break;
			 case 8:
				LLL.displayEssays();
				break;

			
			//9 displays the entire list with all its contents
			 case 9:
				LLL.displayAll();

			 default:
				break;
		}
	}while(again());

	return 0;
}


<file_sep>/Term_Three/prog1/email.h
#include "title.h"

class email : public title
{
	public:
		//contructors and destructor
		email();	~email();
		email(const email & toCopy);
		email(char* name, char* date, char* subject, char* body, char* recipiant, double timeSent);

		//display function
		void display();

	protected:
		char*    subject;	//subject of an email
		char* 	    body;	//actual message the email will hold
		char*  recipiant;	//who is recieving this email
		double  timeSent;	//the time the email was sent
};


class essay : public title
{
	public:
		//constructors and destructor
		essay();	~essay();
		essay(char* name, char* date, char* body, char* dueDate, int wordLength);
		essay(const essay & toCopy);

		//display functions
		void display();

	protected:
		char*     body;	//actual paper
		char*  dueDate;	//due date
		int wordLength;	//length of paper 





};



<file_sep>/Term_Two/Prog5/header.h
#include <iostream>
#include <cstring>
#include <cctype>




/* code by <NAME> for cs163
 * this is supposed to be a lay out of classes and pre requisites
 * uses the graph ADT
 */


using namespace std;


struct vertex
{
	struct myClass* currentClass;	//pointer to class object

	struct node* head;		//head of adjacency list
	struct node* tail;		//tail of adjacency list
};

struct node
{
	int adjacent;	//position in the index of the adjacent class
	node* next;	//next pointer for LLL
	~node();	//node desturcotor
};

struct myClass
{
	char* name;	//name of class
	void copy(myClass* to_copy);	//copies classes 
};

class graph
{

	public:
		graph(int size = 10);	~graph();	//constructor and destructor
		bool insertVertex(myClass* to_insert);		//inserts a vertex
		bool insertEdge(char* name, char* connect);	//inserts an edge with the name and the naem of the class you wish to connect to
//		bool display(void);
		int test(int i);
		bool traverse(char* name);	//traverses based off name you give it
		int findLocation(char* key);	//finds location of given class

	private:
		vertex* list;	//list of verticies
		int list_size;
};
<file_sep>/Term_Two/Prog2/main.cpp
#include "header.h"


int main()
{

	travel circ1;
	travel circ2;


	return_trip stack1;
	return_trip stack2;

	trip_section trip;

	char name[100];
	char traffic[100];
	char notes[100];
	char landmarks[100];
	int length;

	bool exit = false;
	char input;
	int route;


	cout << "Welcome to the trip planner..." << endl
		<< "Please enter your first route, to do so, you will enter the name, \n"
		<< "traffic status, any notes about the road, any landmarks, and the length (miles)" << endl;
	do{

		cout << "Enter the road name: " << endl;
		cin.get(name, 100, '\n');       cin.ignore(100, '\n');

		cout << "Enter traffic condition: " << endl;
		cin.get(traffic, 100, '\n');    cin.ignore(100, '\n');

		cout << "Enter notes: " << endl;
		cin.get(notes, 100, '\n');      cin.ignore(100, '\n');

		cout << "Enter any landmarks: " << endl;
		cin.get(landmarks, 100, '\n');  cin.ignore(100, '\n');

		cout << "Enter length: " << endl;
		cin >> length;  cin.ignore(100, '\n');

		trip.set_trip(name, traffic, notes, landmarks, length);


		circ1.enqueue(&trip);
//		stack1.push(&trip);

		cout << "Would you like to add another? <y,n>: ";
		cin >> input;   cin.ignore(100, '\n');



		if(input == 'n')
			exit = true;
	}while(!exit);

	stack1.push(&trip);

	circ1.display();

	cout << "Please enter the information for the second trip" << endl;

	exit = false;
	input = '\0';

	do{

		cout << "Enter the road name: " << endl;
		cin.get(name, 100, '\n');       cin.ignore(100, '\n');

		cout << "Enter traffic condition: " << endl;
		cin.get(traffic, 100, '\n');    cin.ignore(100, '\n');

		cout << "Enter notes: " << endl;
		cin.get(notes, 100, '\n');      cin.ignore(100, '\n');

		cout << "Enter any landmarks: " << endl;
		cin.get(landmarks, 100, '\n');  cin.ignore(100, '\n');

		cout << "Enter length: " << endl;
		cin >> length;  cin.ignore(100, '\n');

		trip.set_trip(name, traffic, notes, landmarks, length);

		circ2.enqueue(&trip);
//		stack2.push(&trip);

		cout << "Would you like to add another? <y,n>: ";
		cin >> input;   cin.ignore(100, '\n');

		if(input == 'n')
			exit = true;
	}while(!exit);
	stack2.push(&trip);

	circ2.display();

	cout << "This is the trip to your destination via route 1:" << endl;
	circ1.display();

	cout << "Hit enter to see the trip via route 2:" << endl;
	cin; cin.ignore(100, '\n');
	circ2.display();

	cout << "Hit enter to see the trip back home via route 1:" << endl;
	cin; cin.ignore(100, '\n');
//	stack1.display();

	cout << "Hit enter to see the trip back home via route 2:" << endl;   cin; cin.ignore(100, '\n');
//	stack2.display();

	cout << "Please choose a route <1,2>: ";
	cin >> route;   cin.ignore(100, '\n');

	if(route == 1)
	{




	}
	else if(route == 2)
	{
//		circ1.~travel();
//		stack1.~return_trip();

	}
	cout << "At end of program" << endl;



	return 0;
}

<file_sep>/Term_Three/prog3/main.cpp
#include "tree.h"
bool again()
{
	char input;
	cout << "Would you like to go again? <y,n>: ";
	cin >> input;	cin.ignore(100, '\n');	cout << endl;
	return input == 'y';
}

void help()
{
	cout << "Here are your options" << endl
		<< "1: Add a book" << endl
		<< "2: Add a zoom meeting" << endl
		<< "3: Add a website" << endl
		<< "4: Display all" << endl
		<< "5: See these options again" << endl;


}

int main()
{
	char input;

	tree BST;
	node* toAdd;

	book* myBook;
	website* myWeb;
	zoom* myZoom;
	
	
	char subject[100];
	char priority;

	char link[100]; // all the members for the website class

	//all the members for the book class
	char pages[100];
	char author[100];
	char title[100];

	//all the members for the zoom class
	char teacher[100];
	char time[100];
	char id[100];



	//start by populating the tree with information from the external file if there is one
	BST.getFromFile();

	help();

	do
	{
		cin >> input;	cin.ignore(100, '\n');
		switch(input)
		{
			case '1':
				cout << "Please enter the title of the book: ";
				cin.get(title, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Please enter the author of the book: ";
				cin.get(author, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Please enter the length in pages: ";
				cin.get(pages, 100, '\n');	cin.ignore(100, '\n'); 	cout << endl;

				cout << "Please enter the priority from <0-9> 0 being most important: ";
				cin >> priority;	cin.ignore(100, '\n');		cout << endl;

				cout << "Please enter the subject of this book: ";
				cin.get(subject, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				myBook = new book(priority, subject, pages, author, title);
				toAdd = new node();
				toAdd->addBook(*myBook);

				myBook->writeToFile();

				BST.addNode(*toAdd);

				delete myBook;
				delete toAdd;

				myBook = NULL;
				toAdd = NULL;

				break;

			case '2':
				cout << "Please enter the teacher for this zoom meeting: ";
				cin.get(teacher, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Please enter the time: ";
				cin.get(time, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "please enter the zoom meeting id: ";
				cin.get(id, 100, '\n');		cin.ignore(100, '\n');	cout << endl;

				cout << "Please enter the priority from <0-9> 0 being most important: ";
				cin >> priority;	cin.ignore(100, '\n');		cout << endl;

				cout << "Please enter the subject of this book: ";
				cin.get(subject, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				myZoom = new zoom(priority, subject, teacher, time, id);
				toAdd = new node();

				toAdd->addZoom(*myZoom);

				myZoom->writeToFile();

				BST.addNode(*toAdd);

				delete myZoom;
				delete toAdd;

				myZoom = NULL;
				toAdd = NULL;

				break;
			case '3':

				cout << "Please enter the link to this website: ";
				cin.get(link, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Please enter the priority from <0-9> 0 being most important: ";
				cin >> priority;	cin.ignore(100, '\n');		cout << endl;

				cout << "Please enter the subject of this book: ";
				cin.get(subject, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				myWeb = new website(priority, subject, link);
				toAdd = new node();

				toAdd->addWeb(*myWeb);

				myWeb->writeToFile();

				BST.addNode(*toAdd);

				delete myWeb;
				delete toAdd;

				toAdd = NULL;
				myWeb = NULL;

				break;
			case '4':
				BST.display();
				break;
			case '5':
				help();
				break;







		}	





	}while(again());





	BST.getFromFile();

	BST.display();


	/*
	   base* myBase;

	   myWeb = new website('3', "bubject", "www.google.com");

	   myWeb->writeToFile();	



	//	myWeb->writeToFile();

	//	myBook = new book('1', "first book", 200, "<NAME>", "like a bitch");
	//	myBook->writeToFile();

	BST.getFromFile();


	BST.display();




	//book(int priority, char* subject, int pages, char* author, char* title) 
	//

	toAdd.addBook(*myBook);


	//	toAdd.display();

	BST.addNode(toAdd);


	BST.display();
	*/	

	return 0;
}
<file_sep>/Term_Two/Prog3/header.h
#include <iostream>
#include <cstring>
#include <cctype>
#include <fstream>

using namespace std;


struct meal
{
	char* mealName; //name of meal
	char* name;	//name of venue
	int price;	//approximate price
	int rating;	//rating 1-10
	char* review;	//review
	bool type;	//true = cart    false = resturant



	bool copy(meal* to_add);	//copys meals so its easier to add them
	void display();		//displays a meal
	~meal();		//meal destructor
};

struct node
{
	meal* my_meal;		//each node has a meal pointer
	node* next;		//each node also has a next pointer
	~node();		//node destructor
};



class table
{
	public:
		table(int size = 101);	~table();	//constructor and destructor
		bool add(char* key_value, meal* to_add);	//function for adding meals
		int remove(char* meal_name);		//function for removing meals by mealname
		int removeAll(char* name);		//function that removes all meals of certain establishment
		meal* retrieve(char* key_word);		//retrieves meal of desired meal name
		bool display(char* meal_name);	//displays and returns number of nodes;
		int displayAll();		//displays all meals in the whole table

		int hash_function(char* key) const;	//hash function for creating hash key

	private:
		node** hash_table;		//hash table itself, array of pointers to pointers
		int hash_table_size;		//size of hash table (101)





};


<file_sep>/Term_One/prog4_backup/prog4/prog4.h
#include <iostream>
#include <cstring>
#include <cctype>
#include <fstream>
using namespace std;







class Question
{

	public:
		Question(); //Contructor
		void writeToFile(); // writes question to file...
		void initQuestion(char Date[], char Subject[], char Body[]); // initilaizes question without user input
		void initQuestion(); // initiliazes question WITH user input
		void display();// Displays question date, subject, and body
		void compare(char word[]);// compares question to input, either a date, subject, or "all"
	private:
		char subject[21]; // Our subject, ex: loops, files, linked lists...
		char questionBody[140];// question itself..
		char date[11];//the date of the question
};



class List
{
	public:
		List(int length); //Constructor, taking in an int as an argument to create dynamic array
		~List();//destructor
		void initQuestion(int index);//initiliazes question at x index, using the Question initQuestion();
		void initList(); //initiliazes list that the user will enter questions to
		void initFileList(); //initializes list of questions from external file should they want to view them
		void write(int index); // writes question at index x to external file
		void compare(char word[]);//compares using, the compare in the Question class


	private:
		Question* list; // pointer to list for questions the user will enter
		Question* fileList;// pointer to list for the questions from the external file
		int arrayLength; // length of list for input from user
		int fileLength;// amount of lines in the file, necessary for making the fileList of questions from file
};



<file_sep>/Term_One/prog_4/prog4.cpp
#include "prog4.h"
Question::Question()
{
	subject[0] = '\0';
	date[0] = '\0';
	body[0] = '\0';
}
void Question::display()
{
	cout 
		<< "Date: " << date
		<< "\nSubject: " << subject
		<< "\nQuestion: " << body << endl;
}


void Question::write()
{
	ofstream out;
	out.open("question.txt", ios::app);
	if(out)
	{
		out 
			<< date << "|" 
			<< subject << "|"
			<< body << "|\n";
	}
}



void Question::initQuestion()
{
	cout << "Date: ";
	cin.get(date, 11, '\n');
	cin.ignore(100, '\n');

	cout << "\nSubject: ";
	cin.get(subject, 21, '\n');
	cin.ignore(100, '\n');

	cout << "\nQuestion: ";
	cin.get(body, 140, '\n');
	cin.ignore(1000, '\n');
}

List::List(int length)
{
	question = new Question[length];
	fileList = NULL;
	lines = 0;
	char temp[300];
	ifstream in;
	in.open("question.txt");
	if(in)
		in.peek();
	else
		cerr << "Couldn't open file..." << endl;
	while(getline(in, temp))
		++lines;
	fileList = new question[lines];
		for(int i = 0; !in.eof(); ++i)
		{
			in.get(fileList[i].date, 11, '|');
			in.ignore(100, '|');

			in.get(fileList[i].subject, 21, '|');
			in.ignore(100, '|');

			in.get(fileList[i].body, 140, '|');
			in.ignore(140, '\n');

		}	
	fileList[0].display();	
}















<file_sep>/Term_Two/Prog5/main.cpp
#include "header.h"

bool again()
{
	char input;
	cout << "Would you like to enter again? <y,n> " << endl;
	cin >> input;	cin.ignore(100, '\n');

	return input == 'y';
}


int main()
{


	graph myGraph;	//graph object

	myClass toEnter;	//class object for entering things
	char name[100];		//user input

	char connect[100];	//user input

	char input;	//for the switch case

	do
	{
		cout << "=======================" << endl;
		cout << "1: Add a class" << endl;
		cout << "2: Add a pre-req to this class" << endl;
		cout << "3: View what courses you can take after a current one" << endl;
		
		cin >> input;	cin.ignore(100, '\n');

		switch(input)
		{
			case '1':
				cout << "Please enter the name of the class: " << endl;
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');
				toEnter.name = name;

				myGraph.insertVertex(&toEnter);
				break;

			case '2':
				cout << "Please enter the class before the pre req" << endl;
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');

				cout << "Now please enter the pre req" << endl;
				cin.get(connect, 100, '\n');	cin.ignore(100, '\n');

				myGraph.insertEdge(name, connect);
				break;

			case '3':
				cout << "Please enter the class you wish to see" << endl;
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');
				myGraph.traverse(name);

				break;


			default:
				break;



		}






	}while(again());



	return 0;
}
<file_sep>/Term_Three/prog2/list.h
#include "derived.h"




class node
{
	public:
		//constructor and copy constructor
		node(int arrSize);		~node();
		node(const node& toCopy);


		int getPriority(int position);	//returns the priority of the position at a certain index

		base*& getPosition(int position);	//return the address of a base class pointer at a certain index

		bool isFull();	//returns true if the array is full

		node*& goNext();	//returns the next pointer

		void displayAll();	//displays all nodes in a array

		base* getNodeByName(char* name);	//retrurns the first matching base class pointer by matching the name

		//functions for adding the children
		void addSwim(swim* toAdd);
		void addWork(work* toAdd);
		void addHike(hike* toAdd);

		//function to delete a base
		bool deleteBase(char* match);


	private:
		int arrSize;	//size of eadch array

		base** data;	//the array of base class pointers in all its glory
		node* next;	//next pointer
};

//list class
class list
{

	public:
		//constructor an destructor
		list();		~list();

		//returns th array size
		int getArrSize();

		//displayus all contents in all nodes
		void display();

		//functions to add children to the nodes
		void addSwim(swim* toAdd);
		void addWork(work* toAdd);
		void addHike(hike* toAdd);

		//returns the first matching base class by strmp name
		base* getNodeByName(char* name);

		//calls the node::deleteBase fucntions and deltes the first base with a matching name
		bool deleteBase(char* match);

	private:
		int arrSize;	//size of the array in each node

		node* head;	//head and tail pointers
		node* tail;
};
<file_sep>/Term_Three/prog2/base.cpp
#include "base.h"

//default constructor with no arguments using initialization list
base::base() : activityLength(-1), priority(-1), group(false), name(NULL), location(NULL) {}

//copy constructor, copying any dynamically allocated memoery
base::base(const base & toCopy) : activityLength(toCopy.activityLength), priority(toCopy.priority), group(toCopy.group)
{
	this->name = new char[strlen(toCopy.name) + 1];
	strcpy(this->name, toCopy.name);

	this->location = new char[strlen(toCopy.location) + 1];
	strcpy(this->location, toCopy.location);
}


//constructor when given the data members as arguments
base::base(int length, int priority, bool group, char* name, char* location) : activityLength(length), priority(priority), group(group)
{
	this->name = new char[strlen(name) + 1];
	strcpy(this->name, name);

	this->location = new char[strlen(location) + 1];
	strcpy(this->location, location);
}

//destructor deleteing any dynamic memoery
base::~base()
{
	if(this->location && this->name)
	{
	delete [] this->location;
	delete [] this->name;
	}

	this->name = NULL;
	this->location = NULL;
}



//display function
void base::display()
{
	cout << "Name: " << name << endl
		<< "Location: " << location << endl
		<< "Length: " << activityLength << " hours" << endl
		<< "Priority: " << priority << endl;
	if(group)
		cout << "Group Activity" << endl;
	else
		cout << "Not a group activity" << endl;
}

//returns prioprity
int base::getPriority()
{
	return priority;
}
<file_sep>/Term_One/prog5/main.cpp
//Written by <NAME> cs162 <NAME> class
//this program is meant to be a to-do list for winter break
//you can add remove and search for things to do
//
//This program makes use of linear linked lists and recursive functions.
//it also sorts each node that is added into the lit based off name.



#include "prog5.h"
#include "stdlib.h"
void commands()
{
	cout << "\n The way you use this program is like this: " 
		<<"\nTo add somehting you want to do, simply type \"add\"" << endl
		<< "To remove a something on the list type, \"remove\" followed " 
		<< "by the name of the item you wish to remove, like this, \"remove sledding\"" << endl
		<< "To see all the things you want to do, type \"display\", you can also do " 
		<< "\"display 6\" to see all the items with a priority of 6, this can be any number 1-10" << endl
		<< "Finally, if you wish to exit, just type \"exit\"" << endl 
		<< "If you want to see these again type \"help\" " << endl;

}
void seperate(char* word, char*  first, int*  second)
{
	cout << "in seperator" << endl;
	char tempFirst[40], tempLast[40];
	int space = -1;
	int size = strlen(word);
	int count = 0;
	for(int i = 0; i < size; ++i)
	{
		if(isspace(word[i]))
		{
			space = i;
			++i;
		}
		if(space > 0)
		{
			tempLast[count] = word[i];
			++count;
		}
		if(space == -1)	
		{
			tempFirst[i] = word[i];	
		}

	}
	char* secondTemp;
	first = new char[strlen(tempFirst)+1];
	secondTemp = new char[strlen(tempLast)+1];

	strcpy(first, tempFirst);
	strcpy(secondTemp, tempLast);


	int num = atoi(secondTemp);
	second = new int(num);

//	cout << "First: " << first << endl;
//	cout << "Last: " << second << endl;

}

int main()
{

	bool exit = false;
	char input[40];
	char* first;
	int* second;
	List list;


	cout << "Welcome to the TO-DO list!" << endl;
	cout << "\n Winter break is long and there is plenty to do "
		<< "\nso why not write it down!" << endl;

	commands();


	while(!exit)
	{
		cin.get(input, 40, '\n');
		cin.ignore(100, '\n');

		cout << input << endl;


		if(strcmp(input, "help") == 0)
			commands();
		else if(strcmp(input, "exit") == 0)
			exit = true;
		else if(strcmp(input, "add") == 0)
			list.add();
		else if(strcmp(input, "display"))
				{
				seperate(input, first, second);
				}
				cout << first << endl;
				cout << second << endl;

	}





	return 0;
}
<file_sep>/Term_Two/Prog3/class.cpp
#include "header.h"

/*
 * little messy but it works and with no memory leaks
 * code by <NAME>
 */


//function for copying a new node preferably from main to make it a little easier
bool meal::copy(meal* to_add)
{
	this->mealName = new char[strlen(to_add->mealName) + 1];
	this->name = new char[strlen(to_add->name) + 1];
	this->review = new char[strlen(to_add->review) + 1];



	//Copying everything into new node, this is used
	//to make inserting into the hash table easier
	strcpy(mealName, to_add->mealName);
	strcpy(name, to_add->name);
	strcpy(review, to_add->review);
	rating = to_add->rating;
	price = to_add->price;
	type = to_add->type;

	return true;
}


//display function part of meal struct to make it easier to display meals from main and in other 
//display functions
void meal::display()
{
	cout << "Meal name: " << mealName << endl;
	cout << "Name: " << name << endl
		<< "Review: " << review << endl
		<< "Rating <1-10>: " << rating << endl
		<< "Approximate Price Per Meal: " << price << "$" << endl;
	if(type)
		cout << "Type: Food Cart" << endl;
	else
		cout << "Type: Restuarant" << endl;
}

//Meal deconstructor
meal::~meal()
{
	delete [] mealName;
	delete [] name;
	delete [] review;

	mealName = NULL;
	name = NULL;
	review = NULL;
}




//Node deconstructor, recursivly calls destructor on itself
node::~node()
{
	delete next;
	delete my_meal;
}





//----------------------------------------------HashTable functions--------------------------------



//Hashtable contructor, i chose size of 101, initializes all element node* to NULL
table::table(int size)
{
	int i;
	hash_table_size = size;

	hash_table = new node*[hash_table_size];
	for(i = 0; i < hash_table_size; ++i)
		hash_table[i] = NULL;
}

//hashtable deconstructor, calls the node destructor on each element then deletes array of pointers
table::~table()
{
	int i;
	for(i = 0; i < hash_table_size; ++i)
		delete hash_table[i];
	delete [] hash_table;
}




//hash function, takes an array of characters and adds up all their ascii values, then mods it by table size (101)
int table::hash_function(char* key) const
{
	int i;
	int total;

	for(i = 0; i < strlen(key); ++i)
		total += key[i];
	if((total % hash_table_size) < 0)
		return (total % hash_table_size) * -1;
	return total % hash_table_size;
}



//adds a meal to the hash table, in case of collision it creates a linear linked list of the meals with same hashfunction values
bool table::add(char* key_value, meal * to_add)
{
	int key = hash_function(key_value);	//position in hash_table
	node* temp;	//temp pointer



	if(hash_table[key])	//checking to see the the element already has a node (collision)
	{
		temp = hash_table[key];

		hash_table[key] = new node;
		hash_table[key]->my_meal = new meal;
		(*hash_table[key]->my_meal).copy(to_add);
		hash_table[key]->next = temp;
		return true;
	}
	else			//in the case of no collision we just create a new node
	{
		hash_table[key] = new node;
		hash_table[key]->my_meal = new meal;
		(*hash_table[key]->my_meal).copy(to_add);

		hash_table[key]->next = NULL;
		return true;
	}
	return false;
}



//displays the first meal with a matching name, this does not adjust for collision, did not have time
//also returns the position in the hashtable, idk why
bool table::display(char* meal_name)
{
	int key = hash_function(meal_name);

	if(hash_table[key] != NULL)
	{
		(*hash_table[key]->my_meal).display();
		return true;
	}
	return false;
}




//this function was just for me so I could see everything in the table, returns the total number of nodes in the table
int table::displayAll()
{
	int numNode = 0;
	node* temp;
	int i;

	for(i = 0; i < hash_table_size; ++i)
	{
		if(hash_table[i] != NULL)
		{
			cout << "Chain #" << i << ":" << endl;

			temp = hash_table[i];

			do
			{
				++numNode;
				(*temp->my_meal).display();
				cout << endl << endl;
				temp = temp->next;
			}while(temp != NULL);
		}
	}
	return numNode;
}




//this function removes a meal by the meal name
//returns the position that was deleted
int table::remove(char* meal_name)
{

	node* cur;
	node* prev;
	int i;
	int removed;

	for(i = 0; i < hash_table_size; ++i)
	{
		if(hash_table[i] != NULL)
		{
			cur = hash_table[i];
			prev = cur;
		

			//this is a very sketch way of going about the table
			while(cur != NULL)
			{
				if(cur == hash_table[i] && strcmp(meal_name, cur->my_meal->mealName) == 0)	//special case for if there is only one
				{
					hash_table[i] = cur->next;
					removed = hash_function(cur->my_meal->mealName);
					delete cur;
					cur = NULL;
				}
				else
				{
					cur = cur->next;
					if(strcmp(meal_name, cur->my_meal->mealName) == 0)
					{
						prev->next = cur->next;
						removed = hash_function(cur->my_meal->mealName);
						delete cur;
						cur = NULL;
					}
					else
						prev = cur;
				}
			}
		}
	}
	return removed;
}




//removes all meals by establishment name
//returning number of establishments deleted
int table::removeAll(char* name)
{
	node* cur;
	node* prev;
	int i;
	int deleted = 0;

	for(i = 0; i < hash_table_size; ++i)
	{
		if(hash_table[i] != NULL)
		{
			cur = hash_table[i];
			prev = cur;

			while(cur != NULL)
			{

				//special case if its the first node in the list
				if(cur == hash_table[i] && strcmp(hash_table[i]->my_meal->name, name) == 0)
				{
					if(cur->next == NULL)
						hash_table[i] = NULL;
					else
						hash_table[i] = cur->next;

					delete cur;
					cur = hash_table[i];
					++deleted;
				}
				else
				{

					cur = cur->next;
					if(cur && strcmp(cur->my_meal->name, name) == 0)
					{
						if(cur->next = NULL)
							prev->next = NULL;
						else
							prev->next = cur->next;
						delete cur;
						++deleted;
						cur = hash_table[i];
					}
					else
						prev = cur;
				}
			}
		}
	}
	return deleted;

}


//returns the address of the desired meal based off meal name
//checks to see if its null first
//if it doesnt exist it returns null
meal* table::retrieve(char* meal_name)
{
	int key = hash_function(meal_name);

	if(hash_table[key] != NULL)
		return hash_table[key]->my_meal;
	else 
		return NULL;	
}
<file_sep>/Term_Three/prog3/tree.cpp
#include "tree.h"

//constructors
node::node() : id(-1), left(NULL), right(NULL),  myBook(NULL), myWeb(NULL), myZoom(NULL) {}

node::node(const node& toCopy) : id(toCopy.id), left(NULL), right(NULL)
{
	switch(toCopy.id)
	{
		case '0':
			myBook = new book(*toCopy.myBook);
			break;
		case '1':
			myWeb = new website(*toCopy.myWeb);
			break;
		case '2':
			myZoom = new zoom(*toCopy.myZoom);
			break;
		default:
			break;
	}
}

node::~node()
{

	delete left;
	delete right;

	switch(id)
	{
		case 0:
			delete myBook;
			myBook = NULL;
			break;
		case 1:
			delete myWeb;
			myWeb = NULL;
			break;
		case 2:
			delete myZoom;
			myZoom = NULL;
			break;
		default:
			break;
	}
	left = NULL;
	right = NULL;
}


//displays the content of the node
void node::display()
{
	switch(id)
	{
		case '0':
			myBook->display();
			break;
		case '1':
			myWeb->display();
			break;
		case '2':
			myZoom->display();
			break;
		default:
			break;
	}
}


//returns the priority of the contents of the node
char node::getPriority()
{
	char priority = '\0';
	switch(id)
	{
		case '0':
			priority = myBook->getPriority();
			break;
		case '1':
			priority = myWeb->getPriority();
			break;
		case '2':
			priority = myZoom->getPriority();
			break;
		default:
			break;
	}
	return priority;
}

	











//how we know which node holds what type of object 0 = book, 1 = website, 2 = zoom

void node::addBook(book& toAdd)
{
	myBook = new book(toAdd);
	id = '0';
}

void node::addWeb(website& toAdd)
{
	myWeb = new website(toAdd);
	id = '1';
}

void node::addZoom(zoom& toAdd)
{
	myZoom = new zoom(toAdd);
	id = '2';
}




//constructor

tree::tree() : root(NULL) {}

tree::~tree()
{
	delete root;
	root = NULL;
}


//add a node to the tree
void tree::addNode(node& toAdd, node*& root)
{
	if(!root)
	{
		root = new node(toAdd);
		return;
	}
	else
	{
		if(toAdd.getPriority() < root->getPriority())
			addNode(toAdd, root->goRight());
		else
			addNode(toAdd, root->goLeft());
	}



}


//wrapper function
void tree::addNode(node& toAdd)
{
	addNode(toAdd, root);
}

//wrapper fucntion
void tree::display()
{
	display(root);
}

//recursivea display function
void tree::display(node* root)
{
	if(!root)
		return;

	else
	{
	root->display();
	display(root->goLeft());
	display(root->goRight());
	}

}


//populating the tree with information from the external file
void tree::getFromFile()
{
	ifstream in;
	in.open("prog3.txt");

	char type;	// either w, b, z, how we find out which object we are going to be adding

	//members for our base class
	char subject[100];
	char priority;

	char link[100]; // all the members for the website class

	//all the members for the book class
	char pages[100];
	char author[100];
	char title[100];

	//all the members for the zoom class
	char teacher[100];
	char time[100];
	char id[100];

	website* myWeb;
	zoom* myZoom;
	book* myBook;

	node* toAdd;


	if(in)
		in.peek();
	else
		cerr << "Couldn't open file" << endl;

	while(!in.eof())
	{
		in.get(type);
		in.ignore(100, '|');

		switch(type)
		{
			case 'w':
				
				in.get(link, 100, '|');		in.ignore(100, '|');

				in.get(subject, 100, '|');	in.ignore(100, '|');

				in.get(priority);	in.ignore(100, '\n');


				myWeb = new website(priority, subject, link);
				toAdd = new node();

				toAdd->addWeb(*myWeb);

				addNode(*toAdd);

				delete toAdd;
				delete myWeb;

				toAdd = NULL;
				myWeb = NULL;

				break;
			case 'b':

				in.get(pages, 100, '|');	in.ignore(100, '|');

				in.get(author, 100, '|');	in.ignore(100, '|');

				in.get(title, 100, '|');	in.ignore(100, '|');

				in.get(subject, 100, '|');	in.ignore(100, '|');

				in.get(priority);	in.ignore(100, '\n');


				myBook = new book(priority, subject, pages, author, title);
				toAdd = new node();

				toAdd->addBook(*myBook);

				addNode(*toAdd);

				delete toAdd;
				delete myBook;

				toAdd = NULL;
				myBook = NULL;


				break;
			case 'z':

				in.get(teacher, 100, '|');	in.ignore(100, '|');

				in.get(time, 100, '|');		in.ignore(100, '|');

				in.get(id, 100, '|');		in.ignore(100, '\n');

				in.get(subject, 100, '|');	in.ignore(100, '|');

				in.get(priority);		in.ignore(100, '\n');


				myZoom = new zoom(priority, subject, teacher, time, id);
				toAdd = new node();

				toAdd->addZoom(*myZoom);

				addNode(*toAdd);

				delete toAdd;
				delete myZoom;

				toAdd = NULL;
				myZoom = NULL;


				break;
			default:
				break;
		}
	}
}






<file_sep>/Term_Three/prog2/main.cpp
#include "list.h"



void help()
{
	cout << "You have three activities to add, "
		<< "working, hiking, and swiming" << endl;

	cout << "Please see the following for adding: " << endl
		<< "1: Add a new working activity" << endl
		<< "2: Add a new hiking activity" << endl
		<< "3: Add a new swimming activity" << endl
		<< "4: Remove an activity by name" << endl
		<< "5: Add a lunch to a work activity by name" << endl
		<< "6: Plan a work out for a swim activity by name" << endl
		<< "7: Pack climbing shoes for a hike by name" << endl
		<< "D: Display all activities" << endl
		<< "0: To exit program" << endl
		<< "H: To see this prompt again" << endl;
}

char getInput()
{
	char commandInput;

	cout << "Please enter a command: ";
	cin >> commandInput; 	cin.ignore(100, '\n');	cout << endl;

	return commandInput;
}

int main()
{
	list myList;	//our data structur
	base* toFind;	//for dynamic casting

	char commandInput;	//input commands
	char input;		//members inputs
	char locateActivity[50];	//name to match and find base pointers


	//base class memebers 
	char name[40];
	char location[50];
	int priority;
	int activityLength;
	bool isGroupActivity;


	//swim pointer and all it's needed members
	swim* mySwim;
	char swimSuit[40];
	bool member;
	bool hasHotTub;

	//hike pointer and all it's needed members
	hike* myHike;
	bool overNight;
	char season[20];;
	char weather[20];


	//work pointer and all it's needed members
	work* myWork;
	char position[40];;
	double pay;
	bool partTime;



	//how we will be deciding what to do based on user commandInput





	help();

	do
	{
		commandInput = getInput();

		switch(commandInput)
		{
			case '1':

				cout << "Please enter name: ";
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Enter location: ";
				cin.get(location, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Enter priority <1-10> 1 being you want to do it immediatly: ";
				cin >> priority;	cin.ignore(100, '\n');		cout << endl;

				cout << "Enter activity length, in hours, round to the nearest hour: ";
				cin >> activityLength;	cin.ignore(100, '\n');		cout << endl;

				cout << "Is this a group activity? <y,n>: ";
				cin >> input;		cin.ignore(100, '\n');		cout << endl;

				if(input == 'y')
					isGroupActivity = true;
				else
					isGroupActivity = false;

				cout << "Please enter your position in the work place: ";	
				cin.get(position, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Please enter your pay per hour: ";
				cin >> pay;	cin.ignore(100, '\n');			cout << endl;

				cout << "Is this a part time or full time job <p,f>: ";
				cin >> input;	cin.ignore(100, '\n');			cout << endl;
				if(input == 'p')
					partTime = true;
				else
					partTime = false;

				myWork = new work(activityLength, priority, isGroupActivity, name, location, position, pay, partTime);

				cout << "Adding work object" << endl;

				myList.addWork(myWork);

				cout << "Added work object" << endl;

				delete myWork;
				myWork = NULL;

				break;


			case '2':

				cout << "Please enter name: ";
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Enter location: ";
				cin.get(location, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Enter priority <1-10> 1 being you want to do it immediatly: ";
				cin >> priority;	cin.ignore(100, '\n');		cout << endl;

				cout << "Enter activity length, in hours, round to the nearest hour: ";
				cin >> activityLength;	cin.ignore(100, '\n');		cout << endl;

				cout << "Is this a group activity? <y,n>: ";
				cin >> input;		cin.ignore(100, '\n');		cout << endl;

				if(input == 'y')
					isGroupActivity = true;
				else
					isGroupActivity = false;

				cout << "Will this hike be overnight? <y,n>: ";
				cin >> input;	cin.ignore(100, '\n');	cout << endl;

				if(input == 'y')
					overNight = true;
				else
					overNight = false;

				cout << "Current Season: ";
				cin.get(season, 20, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Predicted weather?: ";
				cin.get(weather, 20, '\n');	cin.ignore(100, '\n');	cout << endl;
			
				myHike = new hike(activityLength, priority, isGroupActivity, name, location, overNight, season, weather);

				myList.addHike(myHike);

				delete myHike;
				myHike = NULL;


				break;


			case '3':
				cout << "Please enter name: ";
				cin.get(name, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Enter location: ";
				cin.get(location, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Enter priority <1-10> 1 being you want to do it immediatly: ";
				cin >> priority;	cin.ignore(100, '\n');		cout << endl;

				cout << "Enter activity length, in hours, round to the nearest hour: ";
				cin >> activityLength;	cin.ignore(100, '\n');		cout << endl;

				cout << "Is this a group activity? <y,n>: ";
				cin >> input;		cin.ignore(100, '\n');		cout << endl;

				if(input == 'y')
					isGroupActivity = true;
				else
					isGroupActivity = false;


				cout << "What kind of swimsuit will you wear: ";
				cin.get(swimSuit, 100, '\n');	cin.ignore(100, '\n');	cout << endl;

				cout << "Are you a member? <y,n>: ";
				cin >> input;			cin.ignore(100, '\n');	cout << endl;
				if(input == 'y')
					member = true;
				else
					member = false;

				cout << "Does this pool have a hot tub? <y,n>: ";
				cin >> input;			cin.ignore(100, '\n');	cout << endl;
				if(input == 'y')
					hasHotTub = true;
				else
					hasHotTub = false;

				mySwim = new swim(activityLength, priority, isGroupActivity, name, location, swimSuit, member, hasHotTub);

				myList.addSwim(mySwim);
				cout << "swimSuit: " << swimSuit << endl;

				delete mySwim;
				mySwim = NULL;

				break;

			case '4':
				cout << "Please enter the name of the activity you would like to delete: ";
				cin.get(locateActivity, 40, '\n');	cin.ignore(100, '\n');	cout << endl;

				toFind = myList.getNodeByName(locateActivity);


				if(!toFind)
					cout << "There was no match" << endl;
				else
				{
					cout << "Located and deleted this activity" << endl << endl;
					toFind->display();
				}
				
				myList.deleteBase(locateActivity);
				toFind = NULL;

				break;

			case '5':

				cout << "Enter the work activity you would like to plan a lunch for: ";
				cin.get(locateActivity, 40, '\n');	cin.ignore(100, '\n');	cout << endl;

				toFind = myList.getNodeByName(locateActivity);
				if(toFind)
				{
					myWork = dynamic_cast<work*>(toFind);

					myWork->display();

					if(myWork)
					{
						try
						{
							myWork->planLunch();
						}catch(int e) {}
					}
					else
						cout << "Sorry, couldn't add a lunch to this activity..." << endl;
				}
				myWork = NULL;
				toFind = NULL;

				break;

			case '6':
				cout << "Please enter the swimming activity you would like to work out on: ";
				cin.get(locateActivity, 40, '\n');	cin.ignore(100, '\n');	cout << endl;

				toFind = myList.getNodeByName(locateActivity);

				mySwim = dynamic_cast<swim*>(toFind);

				if(mySwim)
				{
					try
					{
						mySwim->startExercise();
					} catch(int e) {}
				}
				else
					cout << "Sorry, couldn't plan a work out for this activity..." << endl;

				mySwim = NULL;
				toFind = NULL;

				break;

			case '7':
				cout << "Please enter the hike you would like to pack climbing shoes on: ";
				cin.get(locateActivity, 40, '\n');	cin.ignore(100, '\n');	cout << endl;

				toFind = myList.getNodeByName(locateActivity);

				myHike = dynamic_cast<hike*>(toFind);

				if(myHike)
				{
					try
					{
						myHike->rockClimb();
					}catch(int e) {}
				}
				else
					cout << "Sorry, couldn't pack climbing shoes for this activity..." << endl;

				myHike = NULL;
				toFind = NULL;

				break;

			case 'D':
				myList.display();
				break;
			case 'd':
				myList.display();
				break;

			case '0':
				break;

			case 'H':
				help();
				break;
			case 'h':
				help();
				break;

			default:
				cout << "Please enter something valid..." << endl;
				break;
		}

	} while(commandInput != '0');

	cout << "Exiting Program..." << endl;


	return 0;

}
<file_sep>/Term_Two/Prog4_Backup/class.cpp
#include "header.h"








//This is also for ease and displays any given meal
void meal::display()
{
	cout << "Meal name: " << name << endl
		<< "Establishment name: " << storeName << endl
		<< "Review: " << review << endl
		<< "Rating <1-10>: " << rating << endl
		<< "Approximate Price: " << price << "$" << endl
		<< "Type: ";
	if(type)
		cout << "Food cart" << endl;
	else
		cout << "Retaurant" << endl;
}


//This is purely to make things look easier, copies a meal passed in to the current meal
void meal::copy(meal* to_add)
{
	this->name = new char[strlen(to_add->name) + 1];
	this->storeName = new char[strlen(to_add->name) + 1];
	this->review = new char[strlen(to_add->review) + 1];
	
	strcpy(this->name, to_add->name);
	strcpy(this->storeName, to_add->storeName);
	strcpy(this->review, to_add->review);
	this->price = to_add->price;
	this->rating = to_add->rating;
	this->type = to_add->type;
}








//constructor for tree class, setting root to NULL as usual
tree::tree()
{
	root = NULL;
}

//Wrapper function for add function, returns boolean on if it was added or not
bool tree::add(meal* toAdd)
{
	return add(toAdd, root);
}




//Adds a node and returns whether it was succesfull or not 
bool tree::add(meal* toAdd, node*& root)
{

	if(!root)
	{
		root =  new node;
		root->myMeal.copy(toAdd);
		root->left = NULL;
		root->right = NULL;
		return true;
	}
	else
	{
		if(strcmp(root->myMeal.name, toAdd->name) < 0)
			add(toAdd, root->left);
		else
			add(toAdd, root->right);
	}
	return false;
}



int tree::displayMatch(char* mealName)
{
	return displayMatch(mealName, root);
}

//Counts and displays the number of retaurants with matching meal names
//returns the amount of matching meals
int tree::displayMatch(char* mealName, node* root)
{
	int sum = 0;

	if(!root)
		return 0;
	else
	{
		if(strcmp(mealName, root->myMeal.name) == 0)
		{
			root->myMeal.display();
			++sum;
		}
	}

	displayMatch(mealName, root->left);
	displayMatch(mealName, root->right);

	return sum;
}


//Wrapper function for our display fucntion returning the number of nodes in the tree
int tree::display()
{
	return display(root);
}





//displays entire tree and returns the number of nodes in the tree
int tree::display(node* root)
{
	int sum = 0;

	if(!root)
		return 0;
	else
	{
		root->myMeal.display();
		cout << endl;
	}

	sum = display(root->left) + 1;
	sum = display(root->right) + 1;

	return sum;
}












<file_sep>/Term_One/prog4_backup/prog4/main4.cpp

#include "prog4.h"
using namespace std;

int  main()
{

	int count;
	char viewFile, exitVal;
	bool exit = true;
	cout << "How many questions do you want to enter: " << endl;
	cin >> count;
	cin.ignore(100, '\n');
	List list(count);
	for(int i = 0; i < count; ++i)	
	{
		list.initQuestion(i);
		list.write(i);
	}

	cout << "Would you like to access the questions in the file? <y/n>" << endl;
	cin >> viewFile;
	cin.ignore(100, '\n');
	if(viewFile == 'y')
		list.initFileList();

	char input[21];
	while(exit)
	{
		cout << "What question do you want to see, enter a date, subject, or \"all\" to display all questions. " << endl;
		cin.get(input, 21, '\n');
		cin.ignore(1000, '\n');
		list.compare(input);
		cout << "\nWould you like to see more questions? <y/n>" << endl;
		cin >> exitVal;
		cin.ignore(100, '\n');
		if(exitVal == 'n')
			exit = false;	
	}	

	cout << "\nThank you for running the program..." << endl;

	return 0;
}
