• C#之数据类型学习


    C#有以下几种数据类型:

    image

    数据类型案例以及取值范围:

    界面:

    image

    选择int时:

    image

    选中long时:

    image

    选中float时:

    image

    选中double时:

    image

    选中decimal时:

    image

    选中string时:

    image

    选中char时:

    image

    选中Bool时:

    image

    源代码如下:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;

    namespace SecondWpf
    {
         /// <summary>
         /// MainWindow.xaml 的交互逻辑
         /// </summary>
         public partial class MainWindow : Window
         {
             public MainWindow()
             {
                 InitializeComponent();
             }

            private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
             {
             
             }

            private void Button_Click(object sender, RoutedEventArgs e)
             {
                 Close();//当Quit键被按下以后,退出系统
             }

            private void ListBoxItem_Selected(object sender, RoutedEventArgs e)
             {
                 int variable,IntMax,IntMin;
                 variable = 42;
                 IntMax = (int)Math.Pow(2, 32)-1;
                 IntMin = (int)Math.Pow(-2, 32);
                 Value.Text = variable.ToString() ;
                 Down.Text = IntMin.ToString();
                 Uper.Text = IntMax.ToString();
             }

            private void List1_Selected(object sender, RoutedEventArgs e)
             {
                 long LongMax, LongMin,variable;
                 variable = 42L;
         
                 LongMax = (long)Math.Pow(2, 63) - 1;
                 LongMin = (long)Math.Pow(-2, 63);
                 Value.Text = variable.ToString();
                 Down.Text = LongMax.ToString();
                 Uper.Text = LongMin.ToString();
             }

            private void List2_Selected(object sender, RoutedEventArgs e)
             {
                 float variable;
                 string FloatMax, FloatMin;
                 variable = 0.42f;
                 FloatMax = "(+-)1.5*10^45";
                 FloatMin = "(+-)3.4 * 10 ^ 45";
                 Value.Text = variable.ToString();
                 Down.Text = FloatMax;
                 Uper.Text = FloatMin;
             }

            private void List3_Selected(object sender, RoutedEventArgs e)
             {
                 double variable;
                 string DoubleMax;
                 string DoubleMin;
                 variable = 0.43;
                 DoubleMax = "+-5.0*10^-324";
                 DoubleMin = "+-1.7*10^308";
                 Value.Text = variable.ToString();
                 Down.Text = DoubleMax;
                 Uper.Text = DoubleMin;

            }

            private void List4_Selected(object sender, RoutedEventArgs e)
             {
                 decimal coin;
                 string DecimalMax, DecimalMin;
                 coin = 0.42M;
                 DecimalMax ="+-1.0*10^-28";
                 DecimalMin = "+-7.9*10^28";
                 Value.Text = coin.ToString();
                 Down.Text = DecimalMax.ToString();
                 Uper.Text = DecimalMin.ToString();
             }

            private void List5_Selected(object sender, RoutedEventArgs e)
             {
                 string vest;
                 vest = "你好!";
                 Value.Text = vest;
                 Down.Text = "null";
                 Uper.Text = "null";
             }

            private void List6_Selected(object sender, RoutedEventArgs e)
             {
                 char grill;
                 int CharMax, CharMin;
                 grill = 'x';
                 CharMax = (int)Math.Pow(2, 16) - 1;
                 CharMin = 0;
                 Value.Text = grill.ToString();
                 Down.Text = CharMin.ToString();
                 Uper.Text = CharMax.ToString();
             }

            private void List7_Selected(object sender, RoutedEventArgs e)
             {
                 bool teeth;
                 teeth = false;
                 Value.Text = teeth.ToString();
                 Down.Text ="Ture";
                 Uper.Text = "Flase";
             }
         }
    }

  • 相关阅读:
    【并发编程】并发编程随笔索引
    主题记录
    Java技术栈思维导图
    【ES 6.5.4 】ElasticSearch知识点
    Logstash Oracle同步设置
    【ES】【Reference 7.8 译】官方文档Mapping说明
    【ES】【Java High Level REST Client】官方索引和文档操作指导
    【ES】JAVA集成ES与基本操作及官方查询指导
    【实践】Effective Java实践总结
    【MyBatis】Spring集成MyBatis示例
  • 原文地址:https://www.cnblogs.com/Mr-Wangblogs/p/9113256.html
Copyright © 2020-2023  润新知