Try   HackMD

期中考 / 利用陣列數字分離

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

按鈕(開始)

string input = textBox1.Text; int total = 0; int total1 = 0; //(偶數) int total2 = 0; //(奇數) int num = 0; string s = ""; string[] nums = new string[input.Length]; try { if (string.IsNullOrEmpty(input) || (1 <= Convert.ToInt32(input) && Convert.ToInt32(input) >= Int32.MaxValue)) { MessageBox.Show("請輸入數值或輸入數字太大(<=2147483647)", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } else { for (int i = 0; i < input.Length; i++) { nums[i] = input.Substring(i, 1); num = Convert.ToInt32(nums[i]); s += " " + nums[i]; if (num % 2 == 0) { total1 += num; } else { total2 += num; } total += num; } label9.Text = s; label10.Text = total1 + ""; label11.Text = total2 + ""; label12.Text = total + ""; } } catch (Exception ex) { MessageBox.Show("請輸入數值或輸入數字太大(<=2147483647)", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); }

跑馬燈

string str1 = label1.Text.Substring(0, 1); string str2 = label1.Text.Substring(1, label1.Text.Length - 1); string str3 = str2 + str1; label1.Text = str3;

現在時間

label3.Text = "現在時間:" + Convert.ToString(DateTime.Now);
【資歷】王俊勝待更新

個人資料

  • 91年次
  • 目前大一 就讀資訊管理系
  • 常用ID:Junter0323、御痕

經歷:

  • 網路遊戲媒體-總編輯
  • 台北國際電玩展-記者
  • 六都電競賽事-導播
  • 2018金象盃全國大數據實務能力競賽-決賽-第一名
  • 108學年度教育部全國高級中等學校電機與電子群專題-佳作
  • 107年度全國高中職學生電資類群創意競賽-銅牌獎
  • 2018愛寶盃創客機器人大賽-佳作
  • T貓盃 基礎資安能力實務競賽競賽-特優
  • T貓盃 基礎資安能力實務競賽競賽-優勝
  • 亞洲機器人大賽-佳作
  • 南科嘉南盃AI機器人競賽-佳作
  • 愛寶盃創客機器人大賽-佳作
  • 來恩盃資訊能力暨創意應用專題競賽-佳作
  • 遠大盃全國高中職校超微型創業構想競賽-佳作

未來目標:

  • 職業

    • 軟硬工程師
    • 電競賽事導播
  • 課業

  • 成就

    • FPV 飛手證照

不知道可以幹嘛的證照:

  • ICDL 國際資訊安全證照 IT Security
  • 乙級 硬體裝修
  • 乙級 軟體應用
  • 乙級 工業電子
  • 丙級 程式設計
  • 丙級 硬體裝修
  • 丙級 軟體應用
  • 丙級 工業電子

last
update:2021/3/12

 

程式碼如有錯誤!請自行修正。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →
4a990025@stust.edu.tw

Tags: C# 陣列數字 數字分離 偶數 奇數

Copyright © 2021 Junter.Inc All Rights Reserved