. NET face Test 1
1. Narcissus number
Three-bit positive integer, 153=1~3 + 5~3+3~3
for (int i=100; i<1000; i++)
{
Int bai = 0;
Int shi = 0;
Int GE = 0;
Int Baiyushu = 0;
bai=i/100;
baiyushu=i%100;
Shi = BAIYUSHU/10;
GE = baiyushu% 10;
if (i== Bai*bai*bai + shi*shi*shi+ge*ge*ge)
{
Response.Write ("Narcissus number:" +i+ "<br>");
}
}
2. Fibonacci Series::: Recursive
1,1,2,3,5,8,13,21,..........
private int Fun_feibo (int intn)
{
int intresult = 0;
if (intn==1)
{
Intresult = 1;
}
Else
{
if (intn==2)
{
Intresult = 1;
}
Else
{
We need recursion here.
Intresult = Fun_feibo (intN-2) +fun_feibo (intN-1);
}
}
return intresult;
}
3. What is a delegate in C #. An event is not a delegate.
Commissioned, as the name suggests, is the middle agent of the meaning.
[One method can be used as a parameter into another method]
A delegate can be understood to point to a reference to a function, "pointer to function"
Yes, it's a special kind of delegation.
1. Declaration of Commission
delegate void (int,string) delename (parameter list);
2. Declaration method
Modifier return type method name (argument list)
// {