C#Winform基礎 八進位轉換為十六進位(無符號,整數)

來源:互聯網
上載者:User

標籤:學習   語言   number   box   art   names   bsp   nbsp   reading   

鎮場詩:
———大夢誰覺,水月中建部落格。百千磨難,才知世事無常。
———今持佛語,技術無量願學。願盡所學,鑄一良心部落格。
——————————————————————————————————————————

1 UI

 

 

 

2 code

 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using System.Threading.Tasks; 9 using System.Windows.Forms;10 11 namespace WindowsFormsApplication512 {13     public partial class Form1 : Form14     {15         public Form1()16         {17             InitializeComponent();18         }19         20         /// <summary>21         /// 進行進位之間的轉換,有缺陷不能進行有符號的進位之間的轉換22         /// </summary>23         /// <param name="input">被處理的資料</param>24         /// <param name="typeOfInput">輸入的資料是多少進位的</param>25         /// <param name="typeOfOutput">輸出的資料是多少進位的</param>26         /// <returns>返迴轉換完成的資料</returns>27         public string ConvertNumber(string input,int typeOfInput,int typeOfOutput)28         {29             int value = Convert.ToInt32(input, typeOfInput);30             string res = Convert.ToString(value, typeOfOutput);31 32             return res;33         }34 35 36         private void btn8_16_Click(object sender, EventArgs e)37         {38             textBoxOfOutput.Text = ConvertNumber(textBoxOfInput.Text, 8, 16);39         }40     }41 }

 

 

3 show

為了檢驗程式的正確性,我分步驟了,先把八進位轉換成二進位,由二進位看十六進位的轉換是否正確就很容易了

 

 

 

 

 

 

 

——————————————————————————————————————————
博文的精髓,在技術部分,更在鎮場一詩。
C#是優秀的語言,值得努力學習。
如果博文的內容有可以改進的地方,甚至有錯誤的地方,請留下評論,我一定努力改正,爭取鑄成一個良心部落格。
註:此文僅作為科研學習,如果我無意中侵犯了您的權益,請務必及時告知,我會做出改正。

C#Winform基礎 八進位轉換為十六進位(無符號,整數)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.