• C# 作业


    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 WindowsFormsApplication2
    {
        public partial class Form1 : Form
        {
            private int left = 0;
            private int right = 0;
            private Random rd = new Random();
            int num = 0;
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
    
            }
    
            private void label1_Click(object sender, EventArgs e){  }
            private void label3_Click(object sender, EventArgs e){  }
            private void label5_Click(object sender, EventArgs e){ }
            private void label7_Click(object sender, EventArgs e){ }
            private void label8_Click(object sender, EventArgs e){}
            private void Form1_Load(object sender, EventArgs e)
            {
                left = rd.Next(1, 1000);
                right = rd.Next(1, 1000);
                label1.Text = left.ToString();
                label3.Text = right.ToString();
            }
            
            private void button1_Click_1(object sender, EventArgs e)
            {
                string strResult = textBox1.Text;
                int val;
                try
                {
                      val= int.Parse(strResult);
                }
                catch(System.FormatException)
                {
                    label5.Text = " 格式不对 请重新输入  "; return;
                }
                if (left + right == val)
                {
                    label5.Text = " you are right ";
                    num++;
                    label8.Text = num.ToString();
                }
                else
                {
                    label5.Text = " you are wrong ";
                }
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                left = rd.Next(1, 1000);
                right = rd.Next(1, 1000);
                label1.Text = left.ToString();
                label3.Text = right.ToString();
                textBox1.Text = "";
                label5.Text = "";
            }    
        }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        struct SomeVal { public Int32 x; }
        class SomeRef { public Int32 x; }
        class Program
        {
            static void Main(string[] args)
            {
                
     
        
                SomeVal v1 = new SomeVal() ; // 分配到    堆 (堆/栈)
                //Console.WriteLine(v1.x); //能运行吗?  不能        
                v1 = new SomeVal();
                Console.WriteLine(v1.x); //输出  0     
                v1.x =5; 
                Console.WriteLine(v1.x); //输出   5   
    
                SomeRef r1=new SomeRef(); 
               // Console.WriteLine(r1.x); //能运行吗?   不能    
                // 分配到    栈 (堆/栈)
                Console.WriteLine(r1.x); //输出    0  
                r1.x =5;
                Console.WriteLine(r1.x); //输出     5 
    
                SomeVal v2 = v1;
                SomeRef r2 = r1;
                v1.x = 9;
                r1.x = 8;
                Console.WriteLine(r1.x); //输出      8
                Console.WriteLine(r2.x); //输出      8
                Console.WriteLine(v1.x); //输出      9
                Console.WriteLine(v2.x); //输出      5
    
                Console.ReadKey();
            }
        }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication2
    {
        class Program
        {
            static void Main(string[] args)
            {
                string str=Console.ReadLine();
                string sss="";
                int key= Console.ReadKey().KeyChar;
                for (int i = 0; i < str.Length; i++)
                {
                    sss=sss+ (char)( (int)(str[i]) ^ key);
                }
                Console.WriteLine(sss);
                Console.WriteLine(str);
                Console.ReadKey();
            }
        }
    }
  • 相关阅读:
    ELK——Logstash 2.2 mutate 插件【翻译+实践】
    Java 7 jps
    Java 7 jstat – JVM Statistics Monitoring Tool【翻译】
    ELK——Elasticsearch 搭建集群经验
    推荐算法——距离算法
    将 Book-Crossing Dataset 书籍推荐算法中 CVS 格式测试数据集导入到MySQL数据库
    AngularJS datepicker 和 datatimepicker
    AngularJS 模态对话框
    AngularJS Eclipse——新手入门【翻译+整理】
    ELK——为调试 Logstash Grok 表达式,安装 GrokDebuger 环境
  • 原文地址:https://www.cnblogs.com/Andromeda-Galaxy/p/10552325.html
Copyright © 2020-2023  润新知