Skip to content

Instantly share code, notes, and snippets.

#ifdef _DEBUG
#pragma comment(lib,"sfml-graphics-d.lib")
#pragma comment(lib,"sfml-audio-d.lib")
#pragma comment(lib,"sfml-system-d.lib")
#pragma comment(lib,"sfml-window-d.lib")
#pragma comment(lib,"sfml-network-d.lib")
//#pragma comment(lib,"thor-d.lib")
#else
#pragma comment(lib,"sfml-graphics.lib")
#pragma comment(lib,"sfml-audio.lib")
@kenpower
kenpower / dip.cpp
Last active February 29, 2024 10:11
#ifdef _DEBUG
#pragma comment(lib,"sfml-graphics-d.lib")
#pragma comment(lib,"sfml-audio-d.lib")
#pragma comment(lib,"sfml-system-d.lib")
#pragma comment(lib,"sfml-window-d.lib")
#pragma comment(lib,"sfml-network-d.lib")
//#pragma comment(lib,"thor-d.lib")
#else
#pragma comment(lib,"sfml-graphics.lib")
#pragma comment(lib,"sfml-audio.lib")
#include <iostream>
#include <vector>
#include <string>
class Book {
public:
std::string title;
double price;
Book(std::string t, double p) : title(t), price(p) {}
};
@kenpower
kenpower / null.cpp
Last active February 14, 2024 10:26
Null Object
#include <iostream>
class ChaseStrategy{
public:
virtual void chase() = 0;
};
class RandomChase : public ChaseStrategy {
void chase() override {
std::cout << "Randomly wander around\n";
#include <iostream>
#include <string>
#include <vector>
class Drawable {
public:
virtual void draw() const = 0;
};
class Shape : public Drawable {
#include <iostream>
#include <memory>
#include <string>
// English implementation
class EnglishChatbot {
public:
void hello() override {
std::cout << "Hello!" << std::endl;
}
// Name:
// Login:
// Date:
// Approximate time taken:
//---------------------------------------------------------------------------
// Project description: TEMPLATE
// ---------------------------------------------------------------------------
// Known Bugs:
// ?
#include <iostream>
#include <memory>
#include <string>
// Abstract base class (interface)
class Chatbot {
public:
virtual void hello() = 0;
virtual void goodbye() = 0;
};
@kenpower
kenpower / Customer.hpp
Last active November 27, 2023 11:50
Example Code smells for exam
public class Customer {
private String name;
private Address address;
public Customer(String name, Address address) {
this.name = name;
this.address = address;
}
public Address getAddress() {
class Health{
private:
int health;
Player& player;
public:
Health(Player& player) : player(player) {}
void change(int amount){