This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stack> | |
using namespace std; | |
template<typename T> | |
class Queue { | |
private: | |
stack<T> push_stack; | |
stack<T> pop_stack; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Using a stack to test if a string is a palindrome */ | |
#include <iostream> | |
#include <stack> | |
#include <string> | |
using namespace std; | |
bool is_palindrome(const string& palindrome_candidate) { | |
string reversed_candidate = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Try running this program multiple times without fixing anything to see what | |
// we mean by random places in memory. It's kind of more random than a random | |
// number generator. | |
#include <iostream> | |
#include "intlist.h" | |
#include <cmath> | |
#include <cstdlib> | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
struct Leaf { | |
Leaf* left; | |
Leaf* right; | |
int value; | |
Leaf(int value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "course.h" | |
Course::Course() {} | |
Course::Course(const string& courseID, const string& callNo, | |
const string& course_name, const string& course_type, | |
const string& days) | |
: courseID(courseID), callNo(callNo), course_name(course_name), | |
course_type(course_type), days(days) { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CXX=g++ | |
CXXFLAGS=-g -W -Wall -Werror -pedantic -ansi | |
OBJS=person.o | |
MAIN=main.cpp | |
all: $(OBJS) | |
$(CXX) $(CXXFLAGS) $(MAIN) $(OBJS) -o mytwitface | |
person.o: person.h person.cpp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "rectangle.h" | |
#include "point.h" | |
int main() { | |
Point p; | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CXX=g++ | |
CXXFLAGS=-g -W -Wall -Werror | |
OBJECTS=book.o library.o point.o rectangle.o | |
MAIN=main.cpp | |
all: $(OBJECTS) | |
$(CXX) $(CXXFLAGS) $(MAIN) $(OBJECTS) | |
rectangle.o: point.o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
string twoCharInput = ""; | |
string fiveCharInput = ""; | |
string tenCharInput = ""; | |
// Make user continue entering word until it is the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
// In programming, a sentinel value is a special value that guarantees | |
// loop termination when seen. In this example, we use 'q' to represent quit. | |
const string SENTINEL = "q"; | |
string userInput = ""; |