1 / 8

計算機程式及 實習 期末報告

計算機程式及 實習 期末報告. 班級 : 車輛一甲 姓名 : 陳昱亘 學 號 :4A115047 老師 : 謝慶存. 題目說明. 這次期末要我們做的是遊戲 而我第一個想到就是類似占卜的抽籤. 解題分析. 開始執行時 , 馬上顯示表單名稱 , 還有開始抽籤等等 並利用亂數產生 1~6 之隨機亂數 , 並與附檔名 gif 字串做結合成檔案名稱 , 並顯示出來. 程式碼撰寫. Public Class Form1

Download Presentation

計算機程式及 實習 期末報告

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 計算機程式及實習期末報告 班級:車輛一甲 姓名:陳昱亘 學號:4A115047老師:謝慶存

  2. 題目說明 這次期末要我們做的是遊戲而我第一個想到就是類似占卜的抽籤

  3. 解題分析 開始執行時,馬上顯示表單名稱,還有開始抽籤等等 並利用亂數產生1~6之隨機亂數,並與附檔名gif字串做結合成檔案名稱,並顯示出來

  4. 程式碼撰寫 • Public Class Form1 • Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load(程式開啟時) • Me.Text = “今日運氣“(表單顯示”今日運氣”) • Btn.Text= “開始抽籤”(按鈕顯示“開始抽籤”) • txt.Text= “祝你好運“(文字顯示”祝你好運”) • End Sub

  5. Private Sub Btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn.Click(按鈕按下) • Dim luck As Integer(宣告luck為整數) • luck = Fix((6 - 1 + 1) * Rnd()) + 1(luck隨機跑1~6之亂碼) • Pic.Image = Image.FromFile(CStr(luck) & “.gif”)(luck隨機跑亂碼與檔名結合出 現在圖片檔) • Btn.Text = “不滿意嗎?再來一次^^~”(按鈕顯示不滿意嗎?再來一次^^~”) • End Sub • End Class

  6. 實際展示 按下抽籤 再來一次按下時 程式開始時

  7. 各式簽

  8. 參考資料 • Visual Basic 2010 基礎必修課 • 老師上課講解

More Related