zoukankan      html  css  js  c++  java
  • 常见的面试C#技术题目

    遍历查询窗体界面的textbox为空值

    foreach (System.Windows.Forms.Control control in this.Controls)
               {
     
                   if (control is TextBox)
                   {
                       TextBox tx = (TextBox)control;
                       tx.Text = string.Empty;
                   }
               }

      

    一列数的规则如下: 1、1、2、3、5、8、13、21、34......  求第30位数是多少, 用递归算法实现。
    答:public class MainClass 
       
            public static void Main()   
           
                Console.WriteLine(Foo(30)); 
           
            public static int Foo(int i) 
           
                if (i <= 0) 
                    return 0; 
                else if(i > 0 && i <= 2) 
                    return 1; 
                else return Foo(i -1) + Foo(i - 2); 
           
       

      经典的又是冒泡

     
    请编程实现一个冒泡排序算法?
    答:
            int [] array = new int [*] ;
    int temp = 0 ;
    for (int i = 0 ; i < array.Length - 1 ; i++)
    {
    for (int j = i + 1 ; j < array.Length ; j++)
    {
    if (array[j] < array[i])
    {
    temp = array[i] ;
    array[i] = array[j] ;
    array[j] = temp ;
    }
    }
    }

      

    ?
    求以下表达式的值,写出您想到的一种或几种实现方法: 1-2+3-4+……+m
    答:
        int Num = this.TextBox1.Text.ToString() ;
    int Sum = 0 ;
    for (int i = 0 ; i < Num + 1 ; i++)
    {
    if((i%2) == 1)
    {
    Sum += i ;
    }
    else
    {
    Sum = Sum  - I ;
    }
    }
    System.Console.WriteLine(Sum.ToString());
    System.Console.ReadLine() ;

      

    关注.NET开发技术,网站开发,应用系统开发http://www.hnhqwl.com
  • 相关阅读:
    各位AS3各种验证在这里,邮箱 身份证 ...
    各位同学还在为AS3在IE透明模式下弹出新窗口而烦恼吗?
    Flash As3 通过二进制[ByteArray]判断真实的文件类型
    【A8笔记1】Alternativa 8.5.0 在Flash、Fb、Fd中的配置
    超酷光带效果
    flash 墙
    A3D CoverFlow图片展示效果
    Windows8Metro模式IE10放弃Flash的支持
    html5 控件整理
    AS3中JSON的基本应用实例
  • 原文地址:https://www.cnblogs.com/jameslif/p/4969833.html
Copyright © 2011-2022 走看看