<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/sorcodesamples/">
    <title>Code Samples @ ウィキ</title>
    <link>http://w.atwiki.jp/sorcodesamples/</link>
    <atom:link href="https://w.atwiki.jp/sorcodesamples/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>Code Samples @ ウィキ</description>

    <dc:language>ja</dc:language>
    <dc:date>2012-02-25T15:12:29+09:00</dc:date>
    <utime>1330150349</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/16.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/2.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/20.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/19.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/17.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/18.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/13.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/15.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/14.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/sorcodesamples/pages/1.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/16.html">
    <title>C言語</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/16.html</link>
    <description>
      C言語のサンプル集です。
多分実用的なものはありません。

-[[尋ねるまで名前はわからない。&gt;サンプルコードのサンプル]]
-[[デバッグ出力メッセージを管理するのが面倒です。&gt;マクロを使ったデバッグプリント管理]]
-[[ソートの仕方&gt;テーブルをソートする]]    </description>
    <dc:date>2012-02-25T15:12:29+09:00</dc:date>
    <utime>1330150349</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/2.html">
    <title>メニュー</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/2.html</link>
    <description>
      **コンテンツ
-[[メニュー]]
-[[サンプルコード]]
-[[下々の遊び]]
----

**リンク
-[[@wiki&gt;&gt;http://atwiki.jp]]
-[[@wikiご利用ガイド&gt;&gt;http://atwiki.jp/guide/]]



// リンクを張るには &quot;[&quot; 2つで文字列を括ります。
// &quot;&gt;&quot; の左側に文字、右側にURLを記述するとリンクになります


//**更新履歴
//#recent(20)

&amp;link_editmenu(text=ここを編集)    </description>
    <dc:date>2012-02-25T14:57:23+09:00</dc:date>
    <utime>1330149443</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/20.html">
    <title>テーブルをソートする</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/20.html</link>
    <description>
      //c/linenumber

//ArraySort.c
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;time.h&gt;

#define ARRAY_SIZE 10

int main( void ){
	int  a[ARRAY_SIZE];
	int *b[ARRAY_SIZE];
	int *c[ARRAY_SIZE];
	int i,j;
	int *tmp;

	srand((unsigned)time(NULL));

	/* 初期化 */
	for(i =0;i&lt;ARRAY_SIZE;i++){
		a[i] = rand();
		b[i] = &amp;a[i];
		c[i] = &amp;a[i];
	}

	for(i=0;i&lt;ARRAY_SIZE-1;i++){
		for(j=i;j&lt;ARRAY_SIZE;j++){
			//昇順にソート
			if( *b[j] &lt; *b[i] ){
				tmp  = b[i];
				b[i] = b[j];
				b[j] = tmp;
			}

			//降順にソート
			if( *c[i] &lt; *c[j]){
				tmp  = c[i];
				c[i] = c[j];
				c[j] = tmp;
			}
		}
	}

	printf(&quot; i|    a   |     b   |      c    \n&quot;);

	for(i=0;i&lt;ARRAY_SIZE;i++){
		printf(&quot;%2d|%8d| %8d| %8d\n&quot;, i, a[i], *b[i], *c[i] );
	}
	return;
}    </description>
    <dc:date>2012-02-25T02:26:15+09:00</dc:date>
    <utime>1330104375</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/19.html">
    <title>マクロを使ったデバッグプリント管理</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/19.html</link>
    <description>
      //C言語

//マクロを使ったデバッグプリント管理

/*
プログラムの動作を確認するのにprintを使うと思います。
でも、リリースプログラムにprintを残したくない。
しかし、手動でprint文を消して回るのは面倒だと言うときに
*/

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;time.h&gt;

/*
	デバッグ出力するか否かを決めるコンパイルスイッチ
	ファイルが複数であれば、全体でインクルードするヘッダに置くなどする。
*/
#define _ENABLE_DEBUG_PRINT

typedef enum _DebugMessage{
	 DEBUG_MESSAGE_NO_PROBLEM
	,DEBUG_MESSAGE_ERROR
}DebugMessage;

#ifdef	_ENABLE_DEBUG_PRINT
void printDebugMessage( DebugMessage message )
{
	/*
		出力文字列のメンテのために、ファイルをあちこち探し回るのが嫌なので
		文字列を保持する箇所をまとめてあります。
		呼び出し元を探すときは、DebugMessage型の列挙型で検索します。
		小さなファイルであれば、こんな面倒なことしなくても良いかと思います。
	*/
	switch(message)
	{
		case DEBUG_MESSAGE_NO_PROBLEM:
			printf( &quot;No Problem.\n&quot; );
			break;
		case DEBUG_MESSAGE_ERROR:
			printf( &quot;Error happned.\n&quot; );
			break;
		default:
			printf( &quot;Case not defined.\n&quot; );
			break;
	}
}
#else	/* _ENABLE_DEBUG_PRINT */

/*
	_ENABLE_DEBUG_PRINTが定義されていないとき、この空マクロで置き換えられる。
	printDebugMessage関数の未定義で怒られることもなければ、
	デバッグメッセージ関数を消さなくてもメッセージを出力しないようにもなる。
*/
#define	printDebugMessage( mes )

#endif	/* _ENABLE_DEBUG_PRINT */

int main( void )
{
	unsigned int value;

	srand( (unsigned)time( NULL ) );
	value = rand();

	if( (value%2) != 0 ){//あんまりエラーが出ないので確率を1/3にする
		printDebugMessage( DEBUG_MESSAGE_NO_PROBLEM );
	}else{
		//0除算とかやると困るので
		printDebugMessage( DEBUG_MESSAGE_ERROR );
	}

	printf( &quot;value : %d\n&quot;, value%2 );

}    </description>
    <dc:date>2011-08-02T00:46:02+09:00</dc:date>
    <utime>1312213562</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/17.html">
    <title>Java</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/17.html</link>
    <description>
      -[[飛び回る球]]    </description>
    <dc:date>2011-06-30T00:03:22+09:00</dc:date>
    <utime>1309359802</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/18.html">
    <title>飛び回る球</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/18.html</link>
    <description>
      //java/linenumber

package test;

import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class BasicApplet extends Applet implements ActionListener {

	Ball ball;
	Rectangle rect;

	//コンストラクタはやっつけ
	public BasicApplet(){
		this.setSize(120,120);
		this.setBackground(Color.black);
		ball = new Ball(10);
		rect = new Rectangle(10,10,100, 100);
		new javax.swing.Timer(50, this).start();
	}
	
	public void paint(Graphics g){
		ball.draw(g);
	}
	
	//タイマーイベントで、ballの座標を更新する
	public void actionPerformed(ActionEvent arg0) {
		ball.move(rect);
		repaint();
	}

	//飛び回るボールのクラス
	public class Ball {
		private double velocity, arg;	//速度,x軸となす角
		private final double RAD = Math.PI / 180;
		private float hue;//ボールの色を変えるため
		private int x, y, size, sizeOffset;//ボールの位置とサイズ
		private Color color;//色変え用

		public Ball(int size) {
			this.size = size;
			sizeOffset = size / 2;
			x = 10;
			y = 10;
			velocity = 10.0;
			arg = 33.0;
			hue = 0.f;
			color = new Color(0xffffff);
		}

		/**
		 * @param rect ボールの移動範囲となる四角いエリア
		 * */
		public void move(Rectangle rect) {
			int xdist, ydist;
			Point next;
			xdist = (int) (velocity * Math.cos(arg * RAD));
			ydist = (int) (velocity * Math.sin(arg * RAD));

			next = new Point(x + xdist, y + ydist);

			// x range check
			if (next.x &lt; rect.x) {
				next.x = -next.x;
				arg = 180 - arg;
			} else if (rect.width &lt; next.x) {
				next.x = rect.width - (next.x - rect.width);
				arg = 180 - arg;
			}

			// y range check
			if (next.y &lt; rect.y) {
				next.y = -next.y;
				arg = 360 - arg;
			} else if (rect.height &lt; next.y) {
				next.y = rect.height - (next.y - rect.height);
				arg = 360 - arg;
			}
			x = next.x;
			y = next.y;
		}

		//ボールを描画する
		public void draw(Graphics g) {
			if (1.0 &lt;= (hue += 0.05f)) {
				hue = 0;
			}
			g.setColor(new Color(color.HSBtoRGB(hue, 1.f, 1.f)));//色を付ける
			g.fillOval(x - sizeOffset, y - sizeOffset, size, size);
		}
	}
}    </description>
    <dc:date>2011-06-30T00:02:23+09:00</dc:date>
    <utime>1309359743</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/13.html">
    <title>下々の遊び</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/13.html</link>
    <description>
      -レイアウトなどの練習用ページ

*大見出し
**中見出し
***小見出し
****もっと小さい

----

|テーブルは|縦棒で|くぎります|
|連続で|テーブルを|作りました|
|幅は|ながいところに|あわされるんだなぁとかんじられ|
|テーブルのなかで|改行は|できない|    </description>
    <dc:date>2011-06-04T01:14:41+09:00</dc:date>
    <utime>1307117681</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/15.html">
    <title>サンプルコード</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/15.html</link>
    <description>
      サンプルコードです。
-[[C言語]]
-[[Java]]    </description>
    <dc:date>2011-06-04T01:10:07+09:00</dc:date>
    <utime>1307117407</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/14.html">
    <title>サンプルコードのサンプル</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/14.html</link>
    <description>
      //C言語/linenumber
//C言語
//ちょっとひねくれた感じのHelloWorldプログラム

#include &lt;stdio.h&gt;
 
static char* myName( void ){
//プログラム実行中、文字列は定数としてメモリ上のどこかにある。
//nameは、文字列を指すmyName()ローカルのポインタ。
    char* name = &quot;MekeMeke!&quot;;

//nameの生存期間は終わるが、戻り値で&quot;MekeMeke!&quot;のアドレスが分かる。
    return name; 
}
 
int main( void ){
//myName()から&quot;MekeMeke!&quot;のアドレスが帰ってくるので
//mainから直接は見えない文字列を出力できる
    printf( &quot;%s\n&quot;,myName() );
    return 0;

//自分でも使う機会はないと思ってますが、
//文字列がどこに属するか強く結び付けられます。
}    </description>
    <dc:date>2011-06-04T01:00:32+09:00</dc:date>
    <utime>1307116832</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/sorcodesamples/pages/1.html">
    <title>トップページ</title>
    <link>https://w.atwiki.jp/sorcodesamples/pages/1.html</link>
    <description>
      コードを置いときたかったので作りました。










**@wikiへようこそ
-ウィキはみんなで気軽にホームページ編集できるツールです。
-このページは自由に編集することができます。
-メールで送られてきたパスワードを用いてログインすることで、各種変更（サイト名、トップページ、メンバー管理、サイドページ、デザイン、ページ管理、等）することができます

**まずはこちらをご覧ください。
-[[@wikiの基本操作&gt;http://atwiki.jp/guide/category2.html]]
-[[用途別のオススメ機能紹介&gt;http://atwiki.jp/guide/category22.html]]
-[[@wikiの設定/管理&gt;http://atwiki.jp/guide/category6.html]]

**分からないことは？
-[[@wiki ご利用ガイド&gt;http://atwiki.jp/guide/]]
-[[よくある質問&gt;http://atwiki.jp/guide/category1.html]]
-[[無料で会員登録できるSNS内の@wiki助け合いコミュニティ&gt;http://sns.atfb.jp/view_community2.php?no=112]]
-[[@wiki更新情報&gt;http://www1.atwiki.jp/guide/pages/264.html]]
-[[@wikiへのお問合せフォーム&gt;http://atwiki.jp/helpdesk]]
等をご活用ください

**@wiki助け合いコミュニティの掲示板スレッド一覧
#atfb_bbs_list(112)

**その他お勧めサービスについて
-[[大容量１Ｇ、PHP/CGI、MySQL、FTPが使える無料ホームページは@PAGES&gt;&gt;http://atpages.jp/]]
-[[無料ブログ作成は@WORDをご利用ください&gt;&gt;http://atword.jp/]]
-[[2ch型の無料掲示板は@chsをご利用ください&gt;&gt;http://atchs.jp/]]
-[[フォーラム型の無料掲示板は@bbをご利用ください&gt;&gt;http://atbb.jp/]]
-[[お絵かき掲示板は@paintをご利用ください&gt;&gt;http://atpaint.jp/]]
-[[その他の無料掲示板は@bbsをご利用ください&gt;&gt;http://atbbs.jp/]]
-[[無料ソーシャルプロフィールサービス @flabo(アットフラボ)&gt;&gt;http://sns.atfb.jp]]

**おすすめ機能
-[[気になるニュースをチェック&gt;http://atwiki.jp/guide/17_174_ja.html]]
-[[関連するブログ一覧を表示&gt;http://atwiki.jp/guide/17_161_ja.html]]

**その他にもいろいろな機能満載！！
-[[@wikiプラグイン&gt;http://atwiki.jp/guide/category17.html]]
-[[@wiki便利ツール&gt;http://atwiki.jp/guide/category32.html]]
-[[@wiki構文&gt;http://atwiki.jp/guide/category16.html]]
-[[@wikiプラグイン一覧&gt;http://www1.atwiki.jp/guide/pages/264.html]]
-[[まとめサイト作成支援ツール&gt;http://atwiki.jp/matome/]]

**バグ・不具合を見つけたら？ 要望がある場合は？
お手数ですが、メールでお問い合わせください。    </description>
    <dc:date>2011-06-04T00:03:32+09:00</dc:date>
    <utime>1307113412</utime>
  </item>
  </rdf:RDF>
