Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
daba.cs
Package: Visual.rar [view]
Upload User: yiyuerguo
Upload Date: 2014-09-27
Package Size: 3781k
Code Size: 1k
Category:
CSharp
Development Platform:
Others
- using System ;
- public class M
- {
- //public static int[] store;
- //相当于设置了全局变量
- //这个全局变量sum是包含在M类中的
- public static int sum;
- public M()
- {
- int sum =0;
- // int[] store = {1,2,3,4,5,6,7,8,9,0};
- }
- //打印函数
- //符合要求的则把他打印出来
- public static void Output(int[] store2)
- {
- for(int i = 9; i>=0; --i)
- {
- Console.Write(" {0}",store2[i]);
- }
- Console.WriteLine();
- sum++;
- }
- //计算总数 返回sum值
- public static int sum2()
- {
- return sum;
- }
- public static void Cumput(int score, int num, int[] store2 )
- {
- //如果预期达到靶数小于0或者大于10环*剩下要打得次数
- //也就是说即便后面的都打十环也无法打够次数
- //则退出递归
- if(score < 0 || score > (num+1)*10 ) //次数num为0到9
- {
- return;
- }
- //如果满足条件 且达到最后一层
- if(num == 0)
- {
- store2[num] = score;
- Output( store2);
- return;
- }
- for(int i = 0; i <= 10; ++i)
- {
- store2[num] = i;
- Cumput(score - i, num - 1,store2);
- }
- //Console.Write(" {0}",store2[5]);
- }
- }
- public class myApp
- {
- public static void Main( )
- {
- int[] store;
- store = new int[10];
- int sum = 0;
- //int a=90;
- //int b=9;
- //Output();
- M.Cumput(90,9,store);
- sum = M.sum2();
- //M.Cumput2(a,b,store);
- //Console.Write(" {0}",store[3]);
- //cout<<"总数:"<<sum<<endl;
- Console.Write(" 总数: {0}",sum);
- Console.ReadLine();
- }
- }