Skip to content

Instantly share code, notes, and snippets.

View ryuichimatsumoto-single's full-sized avatar

Ryuichi Matsumoto ryuichimatsumoto-single

View GitHub Profile
@ryuichimatsumoto-single
ryuichimatsumoto-single / main.c
Created September 22, 2012 16:04
Simple Quiz Game
#include <stdio.h>
#define TEXT_LENGTH 200//Length of Question
#define ANSWER_KINDS 4//Numbers of Select Answer
#define ANSWER_LENGTH 30//Length of Answers
#define PLOBLEM_NUMBER 1//Numbers of Question
/*
*Struct of Problem
*/
@ryuichimatsumoto-single
ryuichimatsumoto-single / gcd.c
Created September 27, 2012 18:14
自然数a,bの最大公約数GCD(a,b)を求める(calculate of GCD(a,b))
//実行結果は(http://ideone.com/PMb48)参照
/*
*CalcGCD:ユークリッドの互除法により自然数のa,bの最大公約数を計算
*@val a,b:判定に使う二つの自然数
*/
int CalcGCD(int a,int b)
{
//a<bの時は、a,bの値を入れ替えて処理続行
if(a<b)
@ryuichimatsumoto-single
ryuichimatsumoto-single / FizzBuzzExpands.c
Created September 28, 2012 03:08
拡張FizzBuzz問題(Expands of FizzBuzz Ploblem)
/*
*(a,b)=(2,5)のときの結果は、http://ideone.com/7OUIv
*(a,b)=(2,6)のときの結果は、http://ideone.com/xp0bF
*を参照のこと
*/
#define MAX_VALUE 100
#define A 2
#define B 5
#include<stdio.h>
@ryuichimatsumoto-single
ryuichimatsumoto-single / InverseFizzBuzz.php
Created September 28, 2012 15:59
Inverse FizzBuzz Ploblem
<?php
define("MAX_NUMBER","101");
/*
* How to solve InverseFizzBuzz problem
* Copiled program(実行結果):http://ideone.com/yTOtF
* Inverse FizzBuzz Problem explains:http://code.google.com/p/fizzbuzz/
*
*/
$str="";
$str_array=array();
@ryuichimatsumoto-single
ryuichimatsumoto-single / calculate.c
Created October 2, 2012 07:04
平均、分散、標準偏差の求め方
#include<stdio.h>
#include<math.h>
double Average(double *data,int n);
double Verb(double *data,int n);
double Deviation(double *data,int n);
//平均を計算
double Average(double *data,int n)
{
@ryuichimatsumoto-single
ryuichimatsumoto-single / test.php
Created October 4, 2012 05:42
テストで出題されたクラスの問題
<?php
/*
*実行結果:http://ideone.com/nhnON
*/
class A{
static $val = 5;
public function plus($i){
return B::Plus($i);
}
@ryuichimatsumoto-single
ryuichimatsumoto-single / right.php
Created October 4, 2012 06:03
テストで出題されたPHPの問題
<?php
$check =array("10","10x","100","100x");
foreach($check as $val){
if("10" === $val){
echo "+";
}else{
echo $val;
}
}
@ryuichimatsumoto-single
ryuichimatsumoto-single / access.csv
Created October 6, 2012 14:43
histgram.php:ヒストグラムに必要な度数を出力する
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 1 column, instead of 2 in line 5.
# ----------------------------------------
# http://d.hatena.ne.jp/program_study/
# 繝ヲ繝シ繧カ繝シ 繧オ繝槭Μ繝シ
# 20120906-20121006
# ----------------------------------------
譌・,險ェ蝠乗焚
2012/09/06,0
2012/09/07,0
2012/09/08,0
@ryuichimatsumoto-single
ryuichimatsumoto-single / question1.c
Created October 7, 2012 15:10
ガウス記号[x]にかんする問題
//関数のみ記述します
int gauss(double x)
{
if(x<0)
{
return floor(x)-1;
}else
{
return floor(x);
}
@ryuichimatsumoto-single
ryuichimatsumoto-single / array_printf.c
Created October 10, 2012 16:58
array_change_games(配列の並び替えゲーム)
//集合A,B全ての要素を出力する為の関数.
//配列の要素全てが表示される
void array_printf(int array[])
{
int length = sizeof array /sizeof array[0];//calculate length of array
int i=0;
//output message
printf("arrays:");
//output contents of array