2010年9月16日 星期四

c#

為什麼要「培養閱讀」

The handbook of brain theory and neural networks

http://www.3dxtras.com/

http://www.wirecase.com/?section=5&id=1848
http://www.buy3dmodels.com/free3dmodels.php
http://blog.amo-studio.org/2009/06/xna-simple-animation.html
http://www.scifi3d.com/list.asp?intGenreID=14&intCatID=36
December 13-15, 2010 Shenzhen, China

樂陞科技

九十五年度 95智力智力測驗試題

c 語言測驗


[PDF] 

公務人員地方特考三等考試資訊處理類科榜首經驗談



蜘蛛人發明家劉大潭 主持人 江偉君



大愛人物  鄧鴻吉

大愛人物誌10月11日播出 鄧鴻吉的故事
首播10/11(一)17:30
重播10/12(二)02:00 & 10:30


如果你家使用DVD PLAYER看電影,或者你有使用藍芽耳機的習慣,或者你家有紅外線感應式的水龍頭的話,那麼今天的特別來賓已經悄悄的佔據了你的生活,他有台灣愛迪生之稱,他擁有200多項發明專利,他就是鄧鴻吉鄧老師。







c language  lovec.pdf


本校100學年度碩士班甄試招生已開始囉請您將這個好消息轉知給您有需要的親友,讓他(她)有機會進入2010年yes123公布最有價值研究所私立科大第一的優質學府就讀。
簡章發售日期:99/10/25
報名日期:99/11/15~99/12/03
甄試日期:99/12/19


XNA RacingGame CODE


日期 12/31

期末考

1.  依照網頁完成   得50分  網址
乒乓球  XNA - 2D Bounding Box Collision Detection
2.  加上自己的名字 加 10 分
3.  修改背景圖 加 10 分
4.  將飛碟放款在中央並有碰撞效果 加 30 分


日期 12/24

以第二個程式為主

1. Tutorial 1: Displaying a 3D Model on the Screen

2. 3D Tutorial, Chapter 3.1 / Beginner's Guide to XNA Game Studio 3.0

3. http://creators.xna.com/downloads/?id=165

日期 12/17
以第一個程式為主

1.Tutorial 1: Displaying a 3D Model on the Screen

2.3D Tutorial, Chapter 3.1 / Beginner's Guide to XNA Game Studio 3.0

3.http://creators.xna.com/downloads/?id=165

日期 12/10


beginner's guide

2D 飛碟

3D Tutorial, Chapter 3.1 / Beginner's Guide to XNA Game Studio 3.0

快速引導手冊 – 第一步 建立一個遊戲

XNA教程-3D游戏-10-摧毁UFO

------------------------------------------------------------------------------------------------
2010年12月3日


3D XNA TUTARIAL
------------------------------------------------------------------------------------------------

Tutorial 1: Displaying a 3D Model on the Screen

賽車


3D Canvas
Amabilis' 3D modeling and animation tool.
Click here to download 3D Canvas 8.2

3D Models with .x files

free 3ds model
3DXtras.com Newsletter New 3D Models
---------------------------------------

"Hello World!" in XNA

http://www.nazspace.com/wp/game-development/beginner-tutorials/



XNA 遊戲程式設計簡介


                        程式碼



在台灣微軟的XNA 開發人員中心(XNA Developer Center),今日增加了XNA的相關內容

文章內容有簡介XNA、以及如何將遊戲上傳至XBOX360等

現在你可以點擊以下連結觀看相關的文章內容


YouTube - C# with XNA - Tutorial 1 - Part 1

XNA tutorial for C# programmers 

Riemer's 2D & 3D XNA Tutorials




C# Tutorials



------------------------------------------------------------------------------------------------



補考日期 11/19



------------------------------------------------------------------------------------------------
補考題目

紅綠燈
1. 先用小畫家畫四張圖(紅燈、綠燈、黃燈、黑燈)
2. 放入四個 PICTUREBOX 並將四張圖載入。
3. 再放入三個PICTUREBOX,分別都載入黑燈圖片。
4. 再放入一個按鈕,標示"起動"。
     紅燈->黃燈>綠燈->紅燈 ---- 不斷循環。
5. 再放入一個按鈕,標示"停止"。
     三個PICTUREBOX都是黑燈圖片(TIMER  必須停止)。
----------------------------------------------------------------------------------------------------
提示:
1. count=count+1;
2. % 求於數
3 switch
參考
CSHARP TIMER
參考程式,按鈕後數字會遞增

------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
  
    public partial class Form1 : Form
    {
             Timer t = new Timer();
        int count;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

          
            t.Interval = 1000;
            t.Enabled = false;
        
            t.Tick += new EventHandler(Timer_Tick);
        }

        private void button1_Click(object sender, EventArgs e)
        {
        
            t.Start();
            count = 0;
          
        }
        public void Timer_Tick(object sender, EventArgs eArgs)
        {
                count = count + 1;
                label1.Text = Convert.ToString(count);
          
        }
    }
}



--------------------------------------------------------------------------------------------------------------
期中考
1. 小算盤



2. E I G H T   P U Z Z L E
亂數的起始與我們題目不同,請自己做並將每一步記錄。








------------------------------------------------------------------------------------------------------------------------------------



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        int[] arry=new int[4];
        public Form1()
        {
            InitializeComponent();
        }


       


        private void button5_Click(object sender, EventArgs e)
        {
            int temp; int rdno; 
            arry[0] = 0;
            arry[1] = 1;
            arry[2] = 2;
            arry[3] = 3;






           


            for(int i = 0; i < 3; ++i)
            {
           Random rd = new Random(); 
           rdno = rd.Next(0, 4);
           button5.Text = Convert.ToString(rdno);
           temp = arry[rdno];
            arry[rdno] = arry[arry.Length - (i+1)];
            arry[arry.Length-(i+1)]=temp;
            }


            




            //output
            button1.Text = Convert.ToString(arry[0]);
            button2.Text = Convert.ToString(arry[1]);
            button3.Text = Convert.ToString(arry[2]);
            button4.Text = Convert.ToString(arry[3]);


        }
    }
}










-----------------------------------------------------------------------------------------------------------
同學的blog布洛格
楊佳豪 http://lienyueh.blogspot.com/
葉明樺 http://minghuayeh.blogspot.com/


林哲瑜 www.wretch.cc/blog/warbobobo

林俊德 www.wretch.cc/blog/YFU385

楊維帆 http://fcuwf.twbbs.org/ 

王偉亦 www.wretch.cc/blog/jerry12386

吳育全 http://gary1424.blogspot.com/

鄭翊甫www.wretch.cc/blog/ifff

歐明睿www.wretch.cc/blog/pah2853163kd

林修麒 http://aello00382.blogspot.com/

謝治紘 http://nike791224.blogspot.com/

張豫武http://mydisboxyworld.blogspot.com/

蕭銘宏http://sean80221123.blogspot.com/

許晉晏http://blog.yam.com/bibby0616

劉華瑋http://alan5820.blogspot.com/

陳閔信 www.wretch.cc/blog/spirit771212

陳立棠 www.wretch.cc/blog/kingki10

劉哲宇http://nicewintersnow.blogspot.com/

徐靜宜http://star2897.blogspot.com/

吳筱婷http://laura2036108037.blogspot.com/

林維聖http://nweilin.blogspot.com/


王繹涵www.wretch.cc/blog/luckmeand

陳珮綺 http://peach790520.blogspot.com/

孫子庭www.wretch.cc/blog/t1357964

吳煒銘www.wretch.cc/blog/wu19881101
劉子睿 ae00529.blogspot.com

李虹毅http://responsible10.blogspot.com/

宋嘉軒 www.wretch.cc/blog/ken74185963

吳佩蓉http://summerday0311.blogspot.com/

郭濟源 http://kax0205.blogspot.com/

許庭碩www.wretch.cc/blog/cooljdm
郭宗賢http://kuohome123.blogspot.com/

-------------------------------------------------------------------------------------------------------
11月5日 TicTacToe v1.1

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Label Label1;
        public Button button1;
        System.Windows.Forms.Button[] Buttons;
        int bno,nobtpressed=0;
        int[] recordbutn=new int[9]{0, 1, 2,3,4,5,6,7,8};
   
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
           
            Buttons = new System.Windows.Forms.Button[9];
           
            for (int i = 0; i < 9; ++i)
            {
                Buttons[i] = new Button();
                Buttons[i].Size=new Size(50, 50);
              
                Buttons[i].Click += new System.EventHandler(Buttons_Click);
                this.Controls.Add(Buttons[i]);
                if (i <= 2)
                    Buttons[i].Location = new System.Drawing.Point(10 + i * 80, 0 + 10);
                else if (i > 2 && i <= 5)
                    Buttons[i].Location = new System.Drawing.Point(10 + (i - 3) * 80, 50 + 10);
                else if (i > 5 && i <= 9)
                    Buttons[i].Location = new System.Drawing.Point(10 + (i - 6) * 80, 100 + 10);
                Buttons[i].Text = "" + i + "";
            }
           
            /*
            Label1 = new Label();
            Label1.Location = new Point(30, 30);
            Label1.Text = "1";
            Controls.Add(Label1);

            button1 = new Button();
            button1.Location = new Point(60, 60);
            button1.Size = new Size(60, 60);
            button1.Text = "2";
            Controls.Add(button1);
            button1.Enabled = false;

            KeyDown += new KeyEventHandler(Form1_KeyDown);
            button1.Click += new System.EventHandler(Button1_Click);
            */
        }
        public void Buttons_Click(object sender, EventArgs e)
        {
            // System.Windows.Forms.MessageBox.Show("You have clicked button " +
            //   ((System.Windows.Forms.Button)sender).Tag.ToString());
            String tnum = sender.ToString();
            int tlen = tnum.Length;
            int temp;
            String no = tnum.Substring(tlen - 1);
           
            for (int i = 0; i < 9; i++)
            {
                if (Buttons[i].Text == no)
                    bno = i;
            }
            switch (bno)
            {
                case 0:
                    //MessageBox.Show("0");
                    Buttons[0].Image = pictureBox1.Image;
                    nobtpressed = nobtpressed + 1;
                    label3.Text = "" + nobtpressed;
                    temp = recordbutn[0];
                    recordbutn[0] = recordbutn[9 - nobtpressed];
                    recordbutn[9 - nobtpressed] = temp;
                    //button2_Click(sender, e);
                    break;
                case 1:
                    //MessageBox.Show("1");
                    Buttons[1].Image = pictureBox1.Image;
                    nobtpressed = nobtpressed + 1;
                    label3.Text = "" + nobtpressed;
                    temp = recordbutn[1];
                    recordbutn[1] = recordbutn[9 - nobtpressed];
                    recordbutn[9 - nobtpressed] = temp;
                    //button2_Click(sender, e);
                    break;
                case 2:
                    //MessageBox.Show("2");
                    Buttons[2].Image = pictureBox1.Image;
                    nobtpressed = nobtpressed + 1;
                    label3.Text = "" + nobtpressed;
                    temp = recordbutn[2];
                    recordbutn[2] = recordbutn[9 - nobtpressed];
                    recordbutn[9 - nobtpressed] = temp;
                    //button2_Click(sender, e);
                    break;
                case 3:
                    //MessageBox.Show("3");
                    Buttons[3].Image = pictureBox1.Image;
                    nobtpressed = nobtpressed + 1;
                    label3.Text = "" + nobtpressed;
                    temp = recordbutn[3];
                    recordbutn[3] = recordbutn[9 - nobtpressed];
                    recordbutn[9 - nobtpressed] = temp;
                    //button2_Click(sender, e);
                    break;
                case 4:
                    //MessageBox.Show("4");
                    Buttons[4].Image = pictureBox1.Image;
                    nobtpressed = nobtpressed + 1;
                    temp=recordbutn[4];
                    recordbutn[4] = recordbutn[9 - nobtpressed];
                    recordbutn[9 - nobtpressed] = temp;
                    label3.Text = "" + nobtpressed;
                    //button2_Click(sender, e);                   
                    break;
                case 5:
                    //MessageBox.Show("5");
                    Buttons[5].Image = pictureBox1.Image;
                    nobtpressed = nobtpressed + 1;
                    label3.Text = "" + nobtpressed;
                    temp = recordbutn[5];
                    recordbutn[5] = recordbutn[9 - nobtpressed];
                    recordbutn[9 - nobtpressed] = temp;
                    //button2_Click(sender, e);
                    break;
                case 6:
                    Buttons[6].Image = pictureBox1.Image;
                    //MessageBox.Show("6");
                    nobtpressed = nobtpressed + 1;
                    label3.Text = "" + nobtpressed;
                    temp = recordbutn[6];
                    recordbutn[6] = recordbutn[9 - nobtpressed];
                    recordbutn[9 - nobtpressed] = temp;
                    //button2_Click(sender, e);
                    break;
                case 7:
                    //MessageBox.Show("7");
                    Buttons[7].Image = pictureBox1.Image;
                    nobtpressed = nobtpressed + 1;
                    label3.Text = "" + nobtpressed;
                    temp = recordbutn[7];
                    recordbutn[7] = recordbutn[9 - nobtpressed];
                    recordbutn[9 - nobtpressed] = temp;
                    //button2_Click(sender, e);
                    break;
                case 8:
                    //MessageBox.Show("8");
                    Buttons[8].Image = pictureBox1.Image;
                    nobtpressed = nobtpressed + 1;
                    label3.Text = "" + nobtpressed;
                    temp = recordbutn[8];
                    recordbutn[8] = recordbutn[9 - nobtpressed];
                    recordbutn[9 - nobtpressed] = temp;
                    //button2_Click(sender, e);
                    break;
            }
        }
        void Button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("button_click");
}
string a="";
void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
    a = "";
    if (e.KeyCode == Keys.A)
        a = a + "A";
    if (e.KeyCode == Keys.B)
        a = a + "B";
    if (e.KeyCode == Keys.C)
        a = a + "C";
    if (e.KeyCode == Keys.D)
        a = a + "D";
    if (e.KeyCode == Keys.E)
        a = a + "E";
    if (e.KeyCode == Keys.F)
        a = a + "F";
    if (e.KeyCode == Keys.G)
        a = a + "G";
    if (e.KeyCode == Keys.H)
        a = a + "H";
    if (e.KeyCode == Keys.I)
        a = a + "I";
    if (e.KeyCode == Keys.J)
        a = a + "J";
    if (e.KeyCode == Keys.K)
        a = a + "K";
    if (e.KeyCode == Keys.L)
        a = a + "L";
    if (e.KeyCode == Keys.M)
        a = a + "M";
    if (e.KeyCode == Keys.N)
        a = a + "N";
    if (e.KeyCode == Keys.O)
        a = a + "O";
    if (e.KeyCode == Keys.P)
        a = a + "P";
    if (e.KeyCode == Keys.Q)
        a = a + "Q";
    if (e.KeyCode == Keys.R)
        a = a + "R";
    if (e.KeyCode == Keys.S)
        a = a + "S";
    if (e.KeyCode == Keys.T)
        a = a + "T";
    if (e.KeyCode == Keys.U)
        a = a + "U";
    if (e.KeyCode == Keys.V)
        a = a + "V";
    if (e.KeyCode == Keys.W)
        a = a + "W";
    if (e.KeyCode == Keys.X)
        a = a + "X";
    if (e.KeyCode == Keys.Y)
        a = a + "Y";
    if (e.KeyCode == Keys.Z)
        a = a + "Z";
    if (e.KeyCode == Keys.Space)
        a = a + " ";
    if (e.KeyCode == Keys.Enter)
    {
        Label1.Text = a;
        a = "";
    }
    label2.Text = a;
}
private void button2_Click(object sender, EventArgs e)
{
  
 
  
  
   
       nobtpressed = nobtpressed + 1;
       label3.Text = "" + nobtpressed;
        int temp = recordbutn[8];
        recordbutn[8] = recordbutn[9 - nobtpressed];
        recordbutn[9 - nobtpressed] = temp;
        Random rd = new Random();
        int rdno = rd.Next(9 - nobtpressed);
        label2.Text = "" + recordbutn[rdno];
        Buttons[recordbutn[rdno]].Image = pictureBox2.Image;
}
    }
}
------------------------------------------------------------------------------------------



-----------------------------------------------------------------------------------------------------------
XNA  
-----------------------------------------------------------------------------------------------------------
10月22日




練習排序,必須26步就完成,請自己做並將每一步記錄。



-----------------------------------------------------------------------------------------------------------------------------------------------------
原圖
7
2
4
5

6
8
3
1

Step.1
7
2
4

5
6
8
3
1

Step.2

2
4
7
5
6
8
3
1

Step.3
2

4
7
5
6
8
3
1

Step.4
2
5
4
7

6
8
3
1

Step.5
2
5
4
7
6

8
3
1

Step.6
2
5
4
7
6
1
8
3


Step.7
2
5
4
7
6
1
8

3

Step.8
2
5
4
7
6
1

8
3



Step.9
2
5
4

6
1
7
8
3

Step.10
2
5
4
6

1
7
8
3

Step.11
2
5
4
6
1

7
8
3

Step.12
2
5
4
6
1
3
7
8


Step.13
2
5
4
6
1
3
7

8

Step.14
2
5
4
6
1
3

7
8

Step.15
2
5
4

1
3
6
7
8

678位子保留
2
5
4

1
3
6
7
8

Step.16
2
5
4
1

3
6
7
8

Step.17
2
5
4
1
3

6
7
8

Step.18
2
5

1
3
4
6
7
8

Step.19
2

5
1
3
4
6
7
8

Step.20

2
5
1
3
4
6
7
8

Step.21
1
2
5

3
4
6
7
8

Step.22
1
2
5
3

4
6
7
8

Step.23
1
2
5
3
4

6
7
8

Step.24
1
2

3
4
5
6
7
8

345678位子保留
1
2

3
4
5
6
7
8


Step.25
1

2
3
4
5
6
7
8

Step.26

1
2
3
4
5
6
7
8

完成

1
2
3
4
5
6
7
8


------------------------------------------------------------------------------------------------------------------------------------------------------


賽局中的最佳化決策
五、 Player 1與Player 2一起玩井字遊戲(Tic-Tac-Toe),Player 1使用 ‘0’ 符號,Player 2使用 ‘X’ 符號,並由Player 1先下。
1. 假設此賽局僅能下六子(Player 1與Player 2各下三子),請問Player 1總共有多少種策略(strategies)可供運用? (6%)
2. 假設賽局進行至第六子,狀況如下所示,請為剩餘的賽局繪製搜尋樹(search tree),並計算平手的機率。 (6%)
2. 贏電腦
前三名獎勵

如題,這是一個AI的作業,要自己亂數設定,在用程式自己解出答案,網路上找了很多相關的程式碼以及文章都沒辦法跑,想了好幾天了,希望各位高手能替我解答,謝謝!
4 1 7 
3 0 5
6 2 8
零是空白
最後能自己跑成
0 1 2
3 4 5
6 7 8

---------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        System.Windows.Forms.Button[] Buttons;
        System.Windows.Forms.TextBox[] TextBoxs;
        
        int[,] a = new int[4, 4];
        public Form1()
        {
            InitializeComponent();
        }
      
        private void Form1_Load(object sender, EventArgs e)
        {
            Buttons = new System.Windows.Forms.Button[9];
            TextBoxs = new System.Windows.Forms.TextBox[9];
          

            for (int i = 0; i < 9; ++i)
            {
                Buttons[i] = new Button();
               
                Buttons[i].Click += new System.EventHandler(Buttons_Click);
                this.Controls.Add(Buttons[i]);
                if (i <= 2)
                    Buttons[i].Location = new System.Drawing.Point(10 + i * 80, 10+100);
                else if (i > 2 && i <= 5)
                    Buttons[i].Location = new System.Drawing.Point(10 + (i - 3) * 80, 40+100);
                else if (i > 5 && i <= 9)
                    Buttons[i].Location = new System.Drawing.Point(10 + (i - 6) * 80, 70+100);
            }
            for (int i = 0; i < 9; ++i)
            {
                TextBoxs[i] = new TextBox();
                this.Controls.Add(TextBoxs[i]);
                if (i <= 2)
                    TextBoxs[i].Location = new System.Drawing.Point(10 + i * 100, 10);
                else if (i > 2 && i <= 5)
                    TextBoxs[i].Location = new System.Drawing.Point(10 + (i - 3) * 100, 40);
                else if (i > 5 && i <= 9)
                    TextBoxs[i].Location = new System.Drawing.Point(10 + (i - 6) * 100, 70);
            }
            TextBoxs[0].Text = "7";
            TextBoxs[1].Text = "2";
            TextBoxs[2].Text = "4";
            TextBoxs[3].Text = "5";
            TextBoxs[4].Text = "0";
            TextBoxs[5].Text = "6";
            TextBoxs[6].Text = "8";
            TextBoxs[7].Text = "3";
            TextBoxs[8].Text = "1";
        }
        public void Buttons_Click(object sender, EventArgs e)
        {
           // System.Windows.Forms.MessageBox.Show("You have clicked button " +
            //   ((System.Windows.Forms.Button)sender).Tag.ToString());
           
            String tnum = sender.ToString();
            int tlen = tnum.Length;
            String no=tnum.Substring(tlen-1);
           for (int i=0;i<9;i++)
           {
               if (Buttons[i].Text==no)
                   bno=i;
           }
            switch(bno) {
   case 0:
      MessageBox.Show("0");
       break;
   case 1:
      if (Buttons[4].Text == "0")
       {
           String temp;
           temp = Buttons[4].Text;
           Buttons[4].Text =Buttons[1].Text;
           Buttons[1].Text = temp;
       }
       break;
   case 2:
       MessageBox.Show("2");
       break;
   case 3:
       MessageBox.Show("3");
       break;
   case 4:
       MessageBox.Show("4");
       break;
   case 5:
       MessageBox.Show("5");
      break;
   case 6:
      MessageBox.Show("6");
      break;
   case 7:
      MessageBox.Show("7");
      break;
   case 8:
      MessageBox.Show("8");
      break;
}
        private void button1_Click(object sender, EventArgs e)
        {
           //讀入  input
           a[1,1]= Convert.ToInt16(TextBoxs[0].Text);
           a[1, 2] = Convert.ToInt16(TextBoxs[1].Text);
           a[1, 3] = Convert.ToInt16(TextBoxs[2].Text);
           a[2, 1] = Convert.ToInt16(TextBoxs[3].Text);
           a[2, 2] = Convert.ToInt16(TextBoxs[4].Text);
           a[2, 3] = Convert.ToInt16(TextBoxs[5].Text);
           a[3, 1] = Convert.ToInt16(TextBoxs[6].Text);
           a[3, 2] = Convert.ToInt16(TextBoxs[7].Text);
           a[3, 3] = Convert.ToInt16(TextBoxs[8].Text);
            //輸出  output
           for (int i = 0; i < 9; i++)
           {
               if (i < 3)
               {
                   Buttons[i].Text = Convert.ToString(a[1, i + 1]);
               }
               else if (i >= 3 && i < 6)
               {
                   Buttons[i].Text = Convert.ToString(a[2, (i - 3) + 1]);
               }
               else
               {
                   Buttons[i].Text = Convert.ToString(a[3, (i - 3 * 2) + 1]);
               }
           }
        }
       
    }
}

Creating Control Arrays in Visual Basic .NET and Visual C# .NET 

http://msdn.microsoft.com/en-us/library/aa289500(VS.71).aspx


---------------------------------------------------------------------------
10月15日

加分題
1. 題目
三位數,百位大於十和個位。

例:

3 2 1  逆數  123
相減

321-123=198   逆數  891
相加

198+891=1089

試其他三位數滿足條件:百位大於十位。

其結果仍舊  1089

2. 題目:A與B都是 n*n 的矩陣,求相乘結果


wiki matrix multiplication


int[,] a = new int[4, 4];
            int[,] b = new int[4, 4];
            int[,] c = new int[4, 4];
            int m, n;
            m = 4;
            n = 4;
            a[1, 1] = 1;
            a[1, 2] = 0;
            a[1, 3] = 0;
            a[2, 1] = 0;
            a[2, 2] = 1;
            a[2, 3] = 0;
            a[3, 1] = 0;
            a[3, 2] = 0;
            a[3, 3] = 1;
            b[1, 1] = 1;
            b[1, 2] = 0;
            b[1, 3] = 0;
            b[2, 1] = 0;
            b[2, 2] = 1;
            b[2, 3] = 0;
            b[3, 1] = 0;
            b[3, 2] = 0;
            b[3, 3] = 1;
                   
          
            for (int i = 1; i < m; i++)
            {
                for (int j = 1; j < n; j++)
                {
                    for (int k = 1; k < m; k++)
                    {
                        c[i, j] = c[i, j] + a[i, k] * b[k, j];
                    }               
                 Console.WriteLine(" c[" + i + ", " + j + "]=" + c[i, j]);
                }
            }
            Console.WriteLine("ans");
           Console.Read();




按鈕陣列

-------------------------------------------------------------
宣告
System.Windows.Forms.Button[] Buttons;

--------------------------------------------------------------
            Buttons = new System.Windows.Forms.Button[9];

            for (int i = 0; i < 9; ++i)
            {
                Buttons[i] = new Button();
                this.Controls.Add(Buttons[i]);
                if (i <= 2)
                    Buttons[i].Location = new System.Drawing.Point(10 + i * 80, 10);
                else if (i > 2 && i <= 5)
                    Buttons[i].Location = new System.Drawing.Point(10 + (i - 3) * 80, 40);
                else if (i > 5 && i <= 9)
                    Buttons[i].Location = new System.Drawing.Point(10 + (i - 6) * 80, 70);

            }



按鈕陣列
% 注意:複製網頁程式會編議譯錯誤是"字形問題
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{

// System.Windows.Forms.Button Button1;



System.Windows.Forms.Button[] Buttons;



public Form1()

{

InitializeComponent();

}



private void Form1_Load(object sender, EventArgs e)

{

// Button1 = new System.Windows.Forms.Button();

// this.Controls.Add(Button1);

Buttons = new System.Windows.Forms.Button[9];



for (int i = 0; i < 9; ++i)

{

Buttons[i] = new Button();

this.Controls.Add(Buttons[i]);

if (i <= 2)

Buttons[i].Location = new System.Drawing.Point(10 + i * 80, 10);

else if (i > 2 && i <= 5)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 3) * 80, 40);
else if (i > 5 && i <= 9)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 6) * 80, 70);
}
}
}
}




10月8日

作業:

1. A與B都是3*3 的矩陣,求相乘結果


-------------------------------------------------
範例: A與B都是2*2 的矩陣,求相乘結果
-------------------------------------------------
int[,] a = new int[3, 3];
            int[,] b = new int[3, 3];
            int[,] c= new int[3, 3];
            a[1, 1] = 1;
            a[1, 2] = 0;
            a[2, 1] = 0;
            a[2, 2] = 1;
            b[1, 1] = 1;
            b[1, 2] = 2;
            b[2, 1] = 3;
            b[2, 2] = 4;
            c[1, 1] = a[1, 1] * b[1, 1] + a[1, 2] * b[2, 1];
            c[1, 2] = a[1, 1] * b[2, 1] + a[1, 2] * b[2, 2];
            c[2, 1] = a[2, 1] * b[1, 1] + a[2, 2] * b[2, 1];
            c[2, 2] = a[2, 1] * b[2, 1] + a[2, 2] * b[2, 2];
-----------------------------------------------------------



How to: Convert a string to an int (C# Programming Guide)



----------------------------------------------------------------
int a=0, b=0, c=0;
String output;
a = int.Parse(textBox1.Text);
b=int.Parse(textBox2.Text);
c=a*b;
output = Convert.ToString(c);
textBox3.Text = output;
--------------------------------------------------------------


2.在Fom1的clsss裡設定一個事件顯示另一個表單Fom2例如

Form2 newform;
private void button1_Click(object sender, System.EventArgs e)
{
newform= new Form2();
newform.Show();
}


10月1日
物件: Form, textbox, label, button, ListBox.
屬性: x.text

作業:

1. 利用 listbox 呈現99乘法表
提示:
' Add items to the ListBox.
listBox1.Items.Add("A")


2. 費波納西數列

等差数列

範例一  等差數列,首相、公差、末項
----------------------------------------------



----------------------------------------------

範例二 等差級數,求等差數列的和
----------------------------------------------

等差數列
----------------------------------------------
表單
//宣告
int a1,an,d,n,sn;
// 輸入
a1 =int.Parse (textBox1.Text);
d = int.Parse(textBox2.Text);
n = int.Parse(textBox3.Text);
//處理
an=a1+(n-1)*d;
sn = (a1 + an) * n / 2;
//顯示
textBox4.Text = ""+an;
textBox5.Text = "" + sn;
----------------------------------------------

9月24日

範例一  終端機畫面輸出

----------------------------------------------
static void Main(string[] args)
        {
            Console.WriteLine("Hellow");
        }
------------------------------------------------

範例二
------------------------------------------------
int sum = 0;
            for (int i = 1; i <= 10; i++)
            {
                sum = sum + 1;
            Console.WriteLine("i="+i);
            Console.WriteLine("sum=" + sum);
            }
-------------------------------------------------

範例三
------------------------------------------------
 static void Main(string[] args)
        {
            int sum = 0;
            int[] arr1 = new int[101];
            for (int i = 1; i <= 100; i++)
            {
                sum = sum + i;
            Console.WriteLine("i="+i);
            Console.WriteLine("sum=" + sum);
                arr1[i]=sum;
            }
            for (int i = 1; i <= 9; i++)
            {
                for (int j = 1; j <= 9; j++)
                {
                    Console.WriteLine( "i="+i+"j="+j );
                }
            }

        }
------------------------------------------------
二維陣列  99乘法表

 static void Main(string[] args)
        {
            int sum = 0;
            int[,] arr1 = new int[10, 10];
            for (int i = 1; i <= 9; i++)
            {
                for (int j = 1; j <= 9; j++)
                {
                    sum = i * j;
                    arr1[i, j] = sum;
                }
            }


            for (int i = 1; i <= 9; i++)
            {
                for (int j = 1; j <= 9; j++)
                {
                    Console.WriteLine("i=" + i + ",j=" + j +",i*j="+ arr1[i, j]);
                }
            }

        }
------------------------------------------------


9月17日

YouTube - C# with XNA - Tutorial 1 - Part 1

XNA tutorial for C# programmers

Riemer's 2D & 3D XNA Tutorials



C# Tutorials


同學網址:

李佩姍  <orange52036@hotmail.com>



張琛詠 <thif456123@hotmail.com>

林宇樑 <david72123@gmail.com>

C語言考試重點

Hit the Ball and Do Not Miss



我的專利youtube

沒有留言:

張貼留言

追蹤者

關於我自己

我的相片
Welcome to discuss about : Chinese Traditional Medicine and Acupuncture Please send me the email: tccnchsu@gmail.com Chih-Yu Hsu