摘要:文章转载来源于这里:•用于编写单元测试的 NUnit•用于创建代码文档资料的 NDoc•用于生成解决方案的 NAnt•用于生成代码的 CodeSmith•用于监视代码的 FxCop•用于编译少量代码的 Snippet Compiler•两种不同的转换器工具:ASP.NET 版本转换器和 Visual Studio .NET 项目转换器•用于生成正则表达式的 Regulator•用于分析程序集的 .NET Reflector
阅读全文
摘要:1 //------------------------------------------------------------------ 2 //堆排序:关键是堆的构建和堆的调整,而堆的构建本质上也是堆的调整 3 //------------------------------------------------------------------ 4 #include <iostream> 5 using namespace std; 6 7 void swap(int* a,int* b) 8 { 9 if(*a!=*b)10 {11 *a=*a^*...
阅读全文
摘要:字符的替换 1 //将拼音yiersansiwuliuqibajiu转化为123456789 2 #include <iostream> 3 #include <string> 4 5 using namespace std; 6 7 char* s[9]={"yi","er","san","si","wu","liu","qi","ba","jiu"}; 8 9 void fun(char*
阅读全文
摘要:大数相乘 1 //大数相乘 2 #include <iostream> 3 using namespace std; 4 5 void invert(char str1[],char str2[]) 6 { //------------------------------------------- 7 //这前面都是初始化操作,没什么东西 8 int len1=strlen(str1),len2=strlen(str2); 9 int* num1=(int*)malloc(sizeof(int)*len1);10 int* num2=(int*)malloc(...
阅读全文
摘要:都是水题啊 1 //连续字符统计,如aabcccd输出a2b1c3d1 2 #include <iostream> 3 using namespace std; 4 #define N 100 5 6 void func(char* str) 7 { 8 pair<char,int> pr; 9 int i,j=0,len=strlen(str);10 int num[N]={0};11 char c[N]={0};12 13 c[0]=str[0];14 num[0]=1;15 for(i=1;i<len;++i)16 {17...
阅读全文
摘要:1 //删除字符串中字符个数最少的字符 2 #include <iostream> 3 using namespace std; 4 #define N 100 5 6 void remove(char* str,char ch) 7 { 8 int i=0,j,len=strlen(str); 9 int k=len;10 while(i<k)11 {12 if(str[i]==ch)13 {14 for(j=i;j<k-1;++j)15 {16 ...
阅读全文
摘要:回文判断 1 //判断是否为回文 2 #include <iostream> 3 using namespace std; 4 5 void Fun(int num) 6 { 7 int res=0,s=num; 8 do 9 {10 res=res*10+num%10;11 num=num/10;12 }while(num);13 if(res==s) cout<<"Right!";14 else cout<<"Wrong!";15 16 }17 int main()18 {19 int num;20 wh...
阅读全文
摘要:字符的下一个字符//将字符串中的所有字母都替换成该字母的下一个字母#include <iostream>using namespace std;void invert(char* str){ int i; int len=strlen(str); for(i=0;i<len;++i) { if(isalpha(str[i])&&(str[i]!='z')&&(str[i]!='Z')) str[i]=str[i]+1; else if(str[i]=='z') str[i]='a'
阅读全文
摘要:循环数组 1 //数组中的数按步长向右移动,补充到数组头部,简称循环数组 2 #include <iostream> 3 using namespace std; 4 5 void print(int* dig,int n) 6 { 7 for(int i=0;i<n;++i) 8 cout<<dig[i]<<" "; 9 cout<<endl;10 }11 void move(int* dig,int n,int step)12 {13 if (step>=n) return;14 int* tmp=(int*)
阅读全文
摘要:单链表的逆转和排序练习排序还有些问题 1 //链表逆置 指针的指针 2 #include <iostream> 3 using namespace std; 4 5 typedef struct node 6 { 7 int data; 8 node* next; 9 }node; 10 11 node* create() 12 { 13 node *h=(node*)malloc(sizeof(node)),*p; 14 h->data=0; 15 h->next=NULL; 16 p=h; 17 18 int ...
阅读全文
摘要:1 //查找字符串主串中的子串的个数 2 #include <iostream> 3 using namespace std; 4 5 int Findstr(char* str1,char* str2) 6 { 7 int count=0; 8 int len1=strlen(str1); 9 int len2=strlen(str2);10 char *str;11 char tmp[20]={0};12 13 for(int i=0;i<len1-len2+1;++i)14 { 15 strncpy(tmp...
阅读全文
摘要:View Code 1 //将一个十进制的数转化为二进制,并输出二进制数中0的个数,第一个有效字符前的零不算 2 #include <iostream> 3 using namespace std; 4 5 void invert(int num) 6 { 7 int arr[20]; 8 int i=0,count=0,k=0; 9 10 while(num)11 {12 arr[i++]=num%2;13 num=num/2;14 }15 i--;16 do17 {18 if...
阅读全文
摘要:约瑟夫环问题,从某个人开始报数,到某个数,该人出列,继续从下一个开始,直到全部人员出列 1 #include <iostream> 2 using namespace std; 3 4 void Joseph(int n,int m,int s) 5 { 6 int i,j=n; 7 int k=s-1,tmp; 8 int a[20]={0}; 9 for(i=0;i<n;++i)10 a[i]=i+1;11 12 while(n>=2)13 {14 k=(k+m-1)%n;15 tmp=a[k...
阅读全文
摘要:题目:找出一个字符串中是否包含相同的子字符串,要求子字符串的长度大于等于2 1 #include <iostream> 2 using namespace std; 3 4 #define MAXSIZE 100 5 6 void invert(int dig,char *str) 7 { 8 char tmp[MAXSIZE]={0}; 9 int i=0;10 while(dig)11 {12 tmp[i++]=dig%10+'0';13 dig=dig/10;14 }15 tmp[i]='\0';16 1...
阅读全文