<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>脱プログラミング入門</title>
<link>https://ameblo.jp/ameblo-prue/</link>
<atom:link href="https://rssblog.ameba.jp/ameblo-prue/rss20.xml" rel="self" type="application/rss+xml" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com" />
<description>ブログの説明を入力します。</description>
<language>ja</language>
<item>
<title>サンプル</title>
<description>
<![CDATA[ /*<br>2～1000までの正の整数のうち、2の倍数でも，3の倍数でも，また5の倍数でもない整数 を求めるプログラム<br>*/<br><br>#include &lt;stdio.h&gt;<br><br>main(viod) {<br>  int table[1001];<br>  int i;<br><br>  for(i=0;i&lt;1001;i++) {<br>    table[i]=i;<br>  }<br><br>    for(i=2;i&lt;1001;i++){<br>      if (i % 2==0) {<br>      table[i]=0;<br>      } <br>      else if (i % 3==0){<br>      table[i]=0;<br>      } <br>      else if (i % 5==0){<br>      table[i]=0;<br>      } <br>    }<br><br>     for(i=2;i&lt;1001;i++){<br>       if(table[i] != 0) {<br>     printf("%d",table[i]);<br>     printf("\n");<br>       }<br>     }<br>}<br><br>
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10018473692.html</link>
<pubDate>Tue, 17 Oct 2006 16:55:52 +0900</pubDate>
</item>
<item>
<title>選択ソート</title>
<description>
<![CDATA[ <p><font color="#0000ff">選択ソート</font></p><p><font color="#0000ff">【最小値順の場合】<br>①A[0]を最小値と仮定する。<br>②A[0]～A[n-1]内の最小値をA[0]にセットする。<br>③A[0]を除いて、A[1]～A[n-1]内の最小値をA[1]にセットする。<br>④上記処理をA[n-2]～A[n-1]まで繰り返す。</font></p><br><p>#include &lt;stdio.h&gt;</p><p>main() { <br> int i,j,t,min;<br> int n[5]={5,8,4,3,9};</p><p> for(i=0;i&lt;5;i++){<br>  min=i;<br>  for(j=i+1;j&lt;5;j++){<br>   if(n[j] &lt; n[min]){<br>    min=j;<br>   }<br>  }<br>  t=n[i];<br>  n[i]=n[min];<br>  n[min]=t;<br>  printf("%i\n", n[i]);<br> }<br>}<br></p>
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10018376770.html</link>
<pubDate>Sun, 15 Oct 2006 17:27:48 +0900</pubDate>
</item>
<item>
<title>開き直るコツを知りたい</title>
<description>
<![CDATA[ <p>ソフトウエアハウスに勤めたとき、最初の1年ぐらいしかプログラムを書いていなかった。後は設計書ばかり書いていた。自分はSEだと人に宣言したことないが、会社ではSEの値段で発注元に請求している。そのせいなのか、少々プログラミングにコンプレックスを持っている。でも、お陰で基本設計から納品、仕様変更の開発に必要なシステム開発に必要なほとんどのプロセスを経験させていただいた。</p><br><p>学校に通ってから、プログラムを書く機会が増えた。90%以上は自力で書いていた。中に2、3日悩んだものもある。今日振り返ってみると、書いた内容のほとんどを忘れてしまった。ゆっくり思い出せるが、基本的なアルゴリズムばかりで、眼を閉じてもかけるようになりたい。書いたプログラムを繰り返し復習しなければならないと痛感した。</p><p>※復習の仕方について</p><p><a href="http://www.21rots.com/hukusyu.htm">http://www.21rots.com/hukusyu.htm</a></p><br><p>先週悪夢のような１週間だった。3つの課題の締め切り日に続き、1つの中間試験があった。おまけに分からない授業が増えた。今までは先生の説明が分かるようでわからないことが多かった。何とか重要なポイントだけ理解するようにしていた。先週のOSの授業は何に言っているのか、さっぱり分からなかった。ショックで学校のうどん屋で大盛りのうどんを注文して、やけ食いをしていた。</p><br><p>この状態では決して勉強できる状態ではないと思う。私には開き直る精神が必要だ。と思いながらも開きなりきれないのだ。コツがほしいのだ。</p>
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10018354023.html</link>
<pubDate>Sun, 15 Oct 2006 01:08:31 +0900</pubDate>
</item>
<item>
<title>バブルソート</title>
<description>
<![CDATA[ <p><font color="#0000ff">バブルソート、最も原始的なアルゴリズム。</font><font color="#0000ff">バブルソートの処理速度がデータ列の要素数を2乗したものにほぼ比例することを意味する。よって要素数が2倍になれば、処理速度は4倍になる。</font></p><p><font color="#0000ff">array[n]からarray[0]まで 隣同士比較、一番小さい数字をarray[0]に入れる。</font></p><p><font color="#0000ff">array[n]からarray[1] まで隣同士比較、一番小さい数字をarray[1]に入れる。</font></p><p><font color="#0000ff">array[n]からarray[2] まで隣同士比較、一番小さい数字をarray[2]に入れる。</font></p><p><font color="#0000ff">配列の要素が無くなるまで、上記処理を繰り返す。</font></p><p><font color="#0000ff"><br></font></p><p><font color="#0000ff">/*<br>小さい順に並べる<br>*/</font></p><p>#include &lt;stdio.h&gt;</p><p>main() {<br> int n[5]={8,17,45,9,5};<br> int i,j,t;</p><p> for(i=0;i&lt;5;i++) {<br>  for(j=4;j&gt;i;j--){<br>   if(n[j] &lt; n[j-1]){<br>    t=n[j];<br>    n[j]=n[j-1];<br>    n[j-1]=t; <br>   }<br> <br>  }<br>  printf("%d\t",n[i]);<br> }</p><p>}</p><br><p><font color="#0000ff"><br>/*大きい順に並べる*/<br></font></p><p><br></p>
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10018331832.html</link>
<pubDate>Sat, 14 Oct 2006 18:20:28 +0900</pubDate>
</item>
<item>
<title>関数</title>
<description>
<![CDATA[ <p>レポートA-1<br>fun m(x) = <br>if x&gt;100<br>then x-10<br>else m(m(x+11))<br>この関数は、何にを計算するものか、言葉で説明しなさい。<br><br><font size="2">引数Xが101 以下の場合は 出力は91になるでしょう<br><br>仮に Xが95の場合<br>if文により else節が実行されます<br>ここで m(m(x+11))の m(x+11)を評価します ....(1)<br>したがって m(x+11) ... m(95+11) ... m(106)として 再帰します<br><br>引数Xが 106となるので if文は成立しThen節が実行されます<br>したがって 106-10の 96が返り値 となります<br><br>ここで帰るところが (1)の外側の m()になります<br>ここでm(96)を再度評価することになります<br><br>これを繰り返して m(97) m(98) m(99) m(100) m(101) まで繰り返されます<br>最後の m(101)の 返り値は Then節ですので 91となります<br><br>引数Xが 102以上ですと 単に10減算した値が出力になりますよ</font><br><br><br></p><p>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;</p><p>int m( int x ){<br> if ( x &gt; 100 ) {<br>  return x - 10;<br> } else {<br>  int n = m(x+11);<br>  return m(n); <br> }<br>}</p><p>main(void){<br> int x = 0,n=0;<br> x=99.5;<br> n = m( x );<br> printf( "m(%d)=%d\n", x, n );<br>} </p>
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10018228679.html</link>
<pubDate>Thu, 12 Oct 2006 14:52:40 +0900</pubDate>
</item>
<item>
<title>Scheme_構造体</title>
<description>
<![CDATA[ <p><font color="#0000ff">構造体</font></p><p><font color="#0000ff">１．宣言</font></p><p><font color="#0000ff">２．コンストラクタ（make-構造体名）、セレクタ（構造体名-各引数）　構造体？が生成</font></p><br><p><font color="#0000ff">問1：ballの座標値から原点までの距離を求める。</font></p><p>入力　⇒ballの構造体</p><p>処理　⇒distance-to-0関数</p><p>出力　⇒数値（距離）</p><br><p><font color="#ff0000">；；ballの構造体を定義</font></p><p>(define-struct ball<br>  (x y delta-x delta-y))</p><br><p><font color="#ff0000">以下のものが生成</font></p><p><font color="#ff0000">；；make-ball(x y delta-x delta-y)</font></p><p><font color="#ff0000">：：ball-x,ball-y,ball-delta-x,ball-delta-y</font></p><p><font color="#ff0000">；；ball?</font> <br></p><p><font color="#ff0000">；；distance-to-0関数を定義</font></p><p>(define (distance-to-0 a-ball)<br>  (sqrt<br>   (+ (sqr (ball-x a-ball)) (sqr (ball-y a-ball)))))</p><br><p><font color="#ff0000">；；実行<br></font>(distance-to-0 (make-ball 3 4 0 0))</p><br><br><p><span style="COLOR: rgb(0,0,255)">問2：A点とB点のXの差を求める</span></p><p><span style="COLOR: rgb(0,0,255)">入力　⇒A点とB点の構造体</span></p><p><span style="COLOR: rgb(0,0,255)">処理　⇒関数distance 引数A点とB点の構造体のコンストラクタ</span></p><p><span style="COLOR: rgb(0,0,255)">出力　⇒数値</span><br><font color="#ff0000">；；任意点の座標の構造体pointを宣言</font></p><p>(define-struct point(x y z))<br></p><p><font color="#ff0000">；；distance関数を定義</font></p><p>(define (distance pA pB)<br>  (- (point-x pA) (point-x pB)))<br></p><p><font color="#ff0000">；；実行１</font></p><p>(distance (make-point 19 2 3) (make-point 6 7 8))</p><br><p><font color="#ff0000">；；実行２<br></font>(define p0 (make-point 0 0 0))<br>(define p1 (make-point 100 0 0))<br>(distance p0 p1)<br></p><p><br><span style="COLOR: rgb(0,0,255)">問3：3次元空間の、2点間のユークリッド距離を求める</span><br>;;  distance = sqrt( sqr((x1-x2 )+(y1-y2)+(z1-z2)<br>(define-struct point(x y z))<br>(define p0 (make-point 0 0 0))<br>(define p1 (make-point 100 0 0))<br>(define p2 (make-point 0 200 0))<br>(define p3 (make-point 100 100 0))<br><br>(define (distance p-fast p-next)<br>  (cond<br>    [(and (point? p-fast) <br>         (point? p-next))<br>     (sqrt<br>      (+ <br>       (sqr (- (point-x p-fast) (point-x p-next)))<br>       (sqr (- (point-y p-fast) (point-y p-next)))<br>       (sqr (- (point-z p-fast) (point-z p-next)))<br>       ))]<br>    [else 'ERROR]))<br><br>(distance p0 p1)<br>(distance p0 p2)<br>(distance p0 p3)<br>(distance 1 2)<br></p><p>DrSchemeに組み込み済の構造体</p><p>posn構造体　任意1点：属性x　ｙ</p><p><br><font color="#0000ff">問4：3次元上の球を表現する構造体</font></p><br><p>(define-struct point (x y z))<br>(define-struct circle (c r))<br><br>;;c0とc1の距離を求める<br>(define (distance c-fast c-last)<br>  (sqrt<br>   (+<br>    (sqr (- (point-x (circle-c c-fast)) (point-x (circle-c c-last))))<br>    (sqr (- (point-y (circle-c c-fast)) (point-y (circle-c c-last))))<br>    (sqr (- (point-z (circle-c c-fast)) (point-z (circle-c c-last))))<br>    )))<br><br>;;c0とc1の半径の合計を求める<br>(define (sumr c-fast c-last)<br>  (+<br>   (circle-r c-fast)<br>   (circle-r c-last)<br>   ))<br><br>;;over関数を定義<br>(define (over c-fast c-last)<br>  (cond<br>    [(&gt; (distance c-fast c-last) (sumr c-fast c-last)) false]<br>    [else true]))<br><br>;;比較<br>(define c0 (make-circle (make-point 0 0 0) 10))<br>(define c1 (make-circle (make-point 10 0 0) 3))<br>(define c2 (make-circle (make-point 0 -12 0) 2))<br><br>;;(distance c0 c1)<br>;;(sumr c0 c1)<br>(over c0 c1)<br>(over c0 c2)<br>(over c1 c2) </p><br><p><font color="#0000ff">問5：式の計算</font></p><p>(define-struct expr (opc opr1 opr2))<br><br><br>(define (eval expr1)<br>  (cond<br>    [(eq? (expr-opc expr1) 'PLUS) (+ (expr-opr1 expr1) (expr-opr2 expr1))]<br>    [(eq? (expr-opc expr1) 'MUL) (* (expr-opr1 expr1) (expr-opr2 expr1))]<br>    [(eq? (expr-opc expr1) 'DIV) (/ (expr-opr1 expr1) (expr-opr2 expr1))]<br>    [(eq? (expr-opc expr1) 'SUB) (- (expr-opr1 expr1) (expr-opr2 expr1))]<br>    ))<br><br>(eval  (make-expr 'PLUS 1 3))<br>(eval  (make-expr 'MUL 100 2))<br>(eval  (make-expr 'DIV 3 1))<br>(eval  (make-expr 'SUB 1000 200)) <!--<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"         xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"         xmlns:dc="http://purl.org/dc/elements/1.1/"><rdf:Description    rdf:about="http://ameblo.jp/ameblo-prue/entry-10018517633.html"    trackback:ping="http://ameblo.jp/servlet/TBInterface/10018517633/9ac1904b"    dc:title="一時保存（サーバ復旧するまで）"    dc:description="(define-struct expr (opc opr1 opr2))(define (eval expr1)  (cond    [(eq? (expr-opc expr1) &#39;PLUS) (+ (expr-opr1 expr1) (expr-opr2 expr1))]    [(eq? (expr-opc expr1) &#39;MUL) (* (expr-opr1 expr1) (expr-opr2 expr1))]    [(eq? (expr-opc expr1)"    dc:identifier="http://ameblo.jp/ameblo-prue/entry-10018517633.html" /></rdf:RDF>--><!--<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"         xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"         xmlns:dc="http://purl.org/dc/elements/1.1/"><rdf:Description    rdf:about="http://ameblo.jp/ameblo-prue/entry-10018514041.html"    trackback:ping="http://ameblo.jp/servlet/TBInterface/10018514041/30685263"    dc:title="circle (c r)の時のx y z"    dc:description="(define-struct point (x y z))(define-struct circle (c r));;c0とc1の距離を求める(define (distance c-fast c-last)  (sqrt   (+    (sqr (- (point-x (circle-c c-fast)) (point-x (circle-c c-last))))    (sqr (- (point-y (circle-c c-fast)) (point-y ("    dc:identifier="http://ameblo.jp/ameblo-prue/entry-10018514041.html" /></rdf:RDF>--></p>
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10018182428.html</link>
<pubDate>Wed, 11 Oct 2006 14:44:29 +0900</pubDate>
</item>
<item>
<title>入力された文字列の中の小文字のアルファベットを大文字にした文字列を出力</title>
<description>
<![CDATA[ /*<br>1、文字列を入力<br>２、入力された文字列の中の小文字のアルファベットを大文字にした文字列を出力 <br>*/<br><br>#include &lt;stdio.h&gt;<br><br>main() {<br><br>  char str[100];<br>  int i;<br><br>  printf("input character\n");<br><br>  scanf("%s",str);<br><br>  i=0;<br>  while (str[i] != '\0'){<br>    if(str[i]&gt;='a' &amp;&amp; str[i]&lt;='z') {<br>      str[i]=str[i]-'a'+'A';<br>      i++;<br>    }<br>  }<br>  printf("%s\n",str);<br><br>}<br><br>
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10017864997.html</link>
<pubDate>Wed, 04 Oct 2006 12:17:35 +0900</pubDate>
</item>
<item>
<title>入力された文字列を逆順にした文字列を出力するプログラムを作成しなさい。</title>
<description>
<![CDATA[ /*<br>入力された文字列を逆順にした文字列を出力するプログラムを作成しなさい。<br>例えば、appleは、elppaと出力される。文字列とは、文字コード'\0'で終る文字の配列であることを注意すること。<br>処理手順：<br>１、文字配列を０から取得<br>２、 文字配列をnから出力<br>test data：<br>print→tnirp<br>123456789→987654321<br>hello world→olleh<br>@@@@@→@@@@@<br>*/<br><br>#include &lt;stdio.h&gt;<br><br>main() {<br><br>  char str[100];<br>  int len=0;<br>  int i;<br><br>  printf("input string\n");<br>  scanf("%s",str);<br><br>  len=0;<br>  while(str[len] != '\0') {<br>    len++;<br>  }<br><br>  for(i=len;i&gt;=0;i--) {<br>    printf("%c",str[i]);<br>  }<br><br>}
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10017864971.html</link>
<pubDate>Wed, 04 Oct 2006 12:16:53 +0900</pubDate>
</item>
<item>
<title>文字列中に含まれている文字「a」の個数を調べて、その個数を出力。</title>
<description>
<![CDATA[ /*<br>処理手順：<br>１、文字列を入力<br>２、文字列中に含まれている文字「a」の個数を調べて、その個数を出力。<br><br>test data:<br>and→1<br>tea→1<br>hahaha→3<br>yuilo→0<br>12345→0<br>*agaoaa→4<br>*/<br><br>#include &lt;stdio.h&gt;<br><br>main() {<br><br>  char str[100];<br>  int i,j;<br><br><br>  printf("input string.\n");<br>  scanf("%s",str);<br><br>  j=0;<br>  for(i=0;str[i];i++) {<br>    if(str[i]=='a') {<br>      j++;<br>    }<br>  }<br><br>  printf("j=%d",j);<br>}
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10017864949.html</link>
<pubDate>Wed, 04 Oct 2006 12:16:28 +0900</pubDate>
</item>
<item>
<title>文字列中に含まれている、0から9までの各数字の出現回数を表示するプログラム</title>
<description>
<![CDATA[ /*<br>処理手順：<br>１、文字列を入力<br>２、文字列中に含まれている、0から9までの各数字の出現回数を表示するプログラム<br>*/<br><br>#include &lt;stdio.h&gt;<br><br>main() {<br> <br>  char str[100];<br>  int i,ch;<br>  int cnt[10]={0};<br> <br>  while(1){<br>    ch=getchar();<br>    if(ch==EOF) break;<br><br>    switch(ch) {<br>    case '0' : cnt[0]++;break;<br>    case '1' : cnt[1]++;break;<br>    case '2' : cnt[2]++;break;<br>    case '3' : cnt[3]++;break;<br>    case '4' : cnt[4]++;break;<br>    case '5' : cnt[5]++;break;<br>    case '6' : cnt[6]++;break;<br>    case '7' : cnt[7]++;break;<br>    case '8' : cnt[8]++;break;<br>    case '9' : cnt[9]++;break;<br>    } <br>  }<br><br>  for(i=0;i&lt;10;i++) {<br>    printf("%d=%d\n",i,cnt[i]);<br>  }<br><br>} <br>
]]>
</description>
<link>https://ameblo.jp/ameblo-prue/entry-10017864926.html</link>
<pubDate>Wed, 04 Oct 2006 12:15:04 +0900</pubDate>
</item>
</channel>
</rss>
