Skip to content

Instantly share code, notes, and snippets.

View kazmura11's full-sized avatar

Kaz Mu kazmura11

View GitHub Profile
@kazmura11
kazmura11 / Builder.cpp
Last active July 29, 2020 17:22
Design Pattern Builder
#include <string>
#include <iostream>
#include <vector>
#include <memory>
// ピザ
class Pizza {
public:
void setDough(const std::string& dough) {
dough_ = dough;
@kazmura11
kazmura11 / string5.cpp
Last active August 29, 2015 14:07
How to handle string 5
#include <stdio.h>
#include <string.h>
#define MAX_PATH 260
char* get_directory(const char *path)
{
static char dir[MAX_PATH+1];
int i;
for (i = strlen(path) - 1; i >= 0; i--)
{
@kazmura11
kazmura11 / string4.cpp
Created October 4, 2014 20:55
How to handle string 4
#include <stdio.h>
#include <string.h>
#define MAX_PATH 260
static char g_work[MAX_PATH+1];
char* get_directory(const char *path)
{
int i;
for (i = strlen(path) - 1; i >= 0; i--)
@kazmura11
kazmura11 / string3.cpp
Created October 4, 2014 20:54
How to handle string 3
#include <stdio.h>
#include <string.h>
#define MAX_PATH 260
void get_directory(const char *path, char *dir)
{
int i;
for (i = strlen(path) - 1; i >= 0; i--)
{
if (path[i] == '/' || path[i] == '\\')
@kazmura11
kazmura11 / string2.cpp
Last active August 29, 2015 14:07
How to handle string 2
#include <stdio.h>
#include <string.h>
#define MAX_PATH 260
char *get_directory(const char *path, char *dir)
{
int i;
for (i = strlen(path) - 1; i >= 0; i--)
{
if (path[i] == '/' || path[i] == '\\')
@kazmura11
kazmura11 / string1.cpp
Created October 4, 2014 20:52
How to handle string 1 NG
#include <stdio.h>
#include <string.h>
#define MAX_PATH 260
char *get_directory(const char *path)
{
char dir[MAX_PATH+1];
int i;
for (i = strlen(path) - 1; i >= 0; i--)
{
@kazmura11
kazmura11 / simple_crypt.c
Created October 4, 2014 20:49
Simple Crypt
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static const int Offset = 2;
static const int MaxPath = 260;
static const int ReadSize = 1024 * 16;
static const char SpecialExt[] = "kkkkk";
static enum Mode { Encrypt, Decrypt };
@kazmura11
kazmura11 / Bmi.cpp
Last active August 29, 2015 14:07
dll sample Bmi.cpp
#include "Bmi.h"
#include <stdexcept>
namespace MyUtil
{
Bmi::Bmi(const std::string name, const double height, const double weight)
:name_(name), height_(height), weight_(weight), bmi_(0.0)
{
}
@kazmura11
kazmura11 / Source.cpp
Last active August 29, 2015 14:07
dll sample client code
#include "../BmiDll/Bmi.h"
#include <iostream>
#include <iomanip>
#include <vector>
using namespace MyUtil;
int main()
{
std::vector<Bmi *> bmi;
@kazmura11
kazmura11 / Bmi.h
Last active December 26, 2019 14:40
dll sample Bmi.h
#pragma once
#ifdef BMIDLL
#define BMIDLL_API __declspec(dllexport)
#else
#define BMIDLL_API __declspec(dllimport)
#endif
#include <string>
namespace MyUtil