Skip to content

Instantly share code, notes, and snippets.

@otaks
otaks / main.c
Created April 7, 2016 21:48
マージソート
#include "merge_sort.h"
/*
配列の要素を出力
*/
void print_array(const int* array, size_t size)
{
size_t i;
@otaks
otaks / qsort.c
Last active April 10, 2016 02:49
クイックソート 複数キー(複数条件)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct st {
char* AAA;
int BBB;
char* CCC;
};
@otaks
otaks / sscanf
Last active May 1, 2016 10:53
sscanf
#include <stdio.h>
#include <string.h>
int main() {
char tmp[3][10];
char str[10] = "kor,,st";
char tm[10] = { 0 };
strcpy(tm, str);
memset(str, 0x00, sizeof(str));
@otaks
otaks / fizzbuzz.hs
Created April 30, 2016 22:05
fizzbuzz
enable3div x = x `mod` 3 == 0
enable5div x = x `mod` 5 == 0
fizzbuzz x = if ( enable3div x ) && ( enable5div x )
then "Fizz Buzz"
else if ( enable3div x )
then "Fizz"
else if ( enable5div x )
then "Buzz"
else
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
$(function() {
var data = {};
ws = new WebSocket("ws://192.168.33.10:8080/chat");
ws.onopen = function() {
ws.send('hi');
@otaks
otaks / GetFileSize.c
Created May 2, 2016 08:24
GetFileSize
#include <stdio.h>
typedef int bool;
bool true = 1;
bool false = 0;
/**
* ファイルサイズをバイト単位で取得。
*
* @param pName 対象ファイル名(IN)
@otaks
otaks / Module1.bas
Created May 28, 2016 07:10
Module1.bas
Sub outputHtml()
Call outputList
Call outputAriticle
End Sub
Sub outputList()
strFileName = ThisWorkbook.Path + "\list.html"
@otaks
otaks / Module1v2.bas
Created May 29, 2016 04:58
Module1v2.bas
'Option Explicit
Option Base 0
'HTML出力
Sub outputHtml()
Call outputList 'リストHTML出力
Call outputWords '単語群HTML出力
MsgBox ("完了しました。用語集.htmlを開いてください。")
@otaks
otaks / dog.c
Last active June 5, 2016 01:32
c capcel
#include <stdlib.h>
#include "dog.h"
struct dog {
char name[ 20 ];
};
Dog Dog_create( char* name ) {
Dog t = calloc( sizeof( struct dog ) ,1);
memset( t->name, 0x00, sizeof( t->name ) );
@otaks
otaks / Animal.c
Last active June 11, 2016 12:12
c keisho
#include "AnimalP.h"
int Animal_init(Animal animal, char* name) {
memset( animal->name, 0x00, sizeof( animal->name ) );
strcpy( animal->name, name );
}
int Animal_done( Animal animal ) {
/* do nothing */