using System;using System.Collections.Generic;using System.Text;namespace ExMinGongBeiShu{ class MinGongBeiShu { public float minGongBeiShu(int n1, int n2) { int temp = Math.Max(n1, n2); n2 = Math.Min(n1, n2)
using System;using System.Collections.Generic;using System.Text;namespace ExPrimeNumber{ class PrimeNumber { public bool primeNumber(int n) { bool b = true; if (n == 1 || n == 2) b = true;
eg: 28=1+2+4+7+14 即一個數等於它所有公約數(除本身)之和using System;using System.Collections.Generic;using System.Text;namespace ExIsWanShu{ class IsWanShu { public bool IsWanShu(int Num) { int s=0; for (int i=1;i<Num;i++)
歌德巴哈猜想:任何一個大於6的偶數都可以寫為兩個素數之和using System;using System.Collections.Generic;using System.Text;namespace ExGoldbachConjecture{ class GoldbachConjecture { public bool IsPrimeNumber(int n) { bool b = true; if (n =
八皇后問題: 八個皇后在排列時不能同在一行、一列或一條斜線上。在8!=40320種排列中共有92種解決方案 using System;using System.Collections.Generic;using System.Text;namespace ExQueen{ class Queen { public void QueenArithmetic(int size) { int[] Queen = new int[size];
針對“類”類型,C#中的等號相當於C++中的引用,賦值的結果是產生一個引用而非新的對象。如果要產生新的一個對象,內容和老的對象一致,可以通過下面方法實現(使用 MemberwiseClone 複製類):Code highlighting produced by Actipro CodeHighlighter
[原文]IntroductionThe .NET framework provides a lot of ways to implement multithreading programs. I wantto show how we can run a worker thread which makes syncronous calls to a userinterface (for example, a thread that reads a long recordset and fills
using System;using System.Collections.Generic;using System.Text;namespace binaryTree{ class Program { static void Main(string[] args) { //使用者操作 } } //定義: 二叉樹的儲存結構類 public class Node<T> {
using System;using System.Collections.Generic;using System.Text;namespace ExSum{ class Sum { public long sum(int num) { long sum = 0; for (int i = 1; i <= num; i++) { long f = 1;