zoukankan
html css js c++ java
Just For Fun
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Collections;
namespace
TestFuns
{
class
Program
{
Functions
#region
Functions
/**/
///
<summary>
///
数列
///
</summary>
///
<param name="n"></param>
///
<returns></returns>
private
static
int
numlist(
int
n)
{
if
(n
<
2
)
return
1
;
else
return
numlist(n
-
1
)
+
numlist(n
-
2
);
}
/**/
///
<summary>
///
显示1-50随机数,各不相同
///
</summary>
private
static
void
InsertRandomArr()
{
int
tmpNum
=
0
;
ArrayList newarr
=
new
ArrayList();
Random rd
=
new
Random();
while
(newarr.Count
<
50
)
{
tmpNum
=
rd.Next(
0
,
51
);
if
(
!
newarr.Contains(tmpNum))
newarr.Add(tmpNum);
}
for
(
int
i
=
49
; i
>
0
; i
--
)
{
Console.Write(newarr[i].ToString()
+
"
"
);
}
}
#endregion
DelegateDemo
#region
DelegateDemo
public
class
ShowMsgInfo
{
public
delegate
string
msgOut(
string
str);
public
msgOut ShowMsg;
}
public
static
string
ShowHTML(
string
str)
{
return
string
.Format(
"
<B>{0}</B>
"
, str);
}
public
static
string
ShowTXT(
string
str)
{
return
str;
}
#endregion
static
void
Main(
string
[] args)
{
for
(
int
i
=
0
; i
<
10
; i
++
)
Console.WriteLine(numlist(i));
InsertRandomArr();
ShowMsgInfo sm
=
new
ShowMsgInfo();
sm.ShowMsg
=
new
ShowMsgInfo.msgOut(ShowHTML);
Console.WriteLine(sm.ShowMsg(
"
Test
"
));
sm.ShowMsg
=
new
ShowMsgInfo.msgOut(ShowTXT);
Console.WriteLine(sm.ShowMsg(
"
Test2
"
));
Console.Read();
}
}
}
查看全文
相关阅读:
数据类型
泛型
如何同步ORACLE和sqlserver的数据
JBOss 端口没占用!
Oracle数据库启动流程
无法通过 128 (在表空间 TEMP 中) 扩展 temp 段
数组的选择排序和冒泡排序
Java条形码生成方案及二维码要点
更改表字段的长度
jquery 产品查看放大镜组件
原文地址:https://www.cnblogs.com/netwenchao/p/1602721.html
最新文章
zookeeper和Kafka集群安装配置
jQuery中 attr和Prop的区别
mac 安装Homebrew
Linux_09------Linux上系统扫描和安全策略
PHP性能优化简述
Linux搭建smtp服务器+laravel5.2发邮件配置
Linux_08------Linux的系统管理
Linux_07------Linux的用户和用户组管理
Linux_06------Linux的磁盘管理
Linux_05------Linux之vim编辑器
热门文章
Linux_04------Linux权限的设定
Linux_03------Linux的基本命令
.net core day01
托管代码和非托管代码
委托
多态
JavaScript原型
JavaScript预编译是个什么鬼
list和元组(tuple)基本操作
抽象类和开闭原则
Copyright © 2011-2022 走看看