摘要: 一、代码 1 #include 2 using namespace std; 3 //求整形数组中最大的元素 4 int imax(int array[],int count) 5 { 6 int temp=array[0]; 7 for (int i=0;i=array[i])23 temp=array[i];24 }25 cout>MaxSize;34 int *Array=new int[MaxSize];35 cout>Array[i];39 } 40 imax(Array,MaxSize);41... 阅读全文
posted @ 2013-09-18 21:15 不懂编程的程序员 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 一、代码 1 //字符串反转 2 #include 3 using namespace std; 4 void mystrrev(char string[]) 5 { 6 int len=strlen(string);//判断字符串长度 7 cout=0;i--) 9 {10 cout>a;19 mystrrev(a);20 }二、演示 阅读全文
posted @ 2013-09-18 15:40 不懂编程的程序员 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 一、代码 1 //在输入的字符串中查找特定字符,查到返回位置和个数 2 #include 3 using namespace std; 4 int mystrchr(char string[],char c) 5 { 6 int len=strlen(string);//判断字符串长度 7 int count=0;//记录c的个数 8 cout>a;25 cout>m;28 mystrchr(a,m);29 }二、演示 阅读全文
posted @ 2013-09-18 15:32 不懂编程的程序员 阅读(853) 评论(0) 推荐(0) 编辑
摘要: while(条件){ ........}条件成立,执行括号内语句;条件不成立,跳出while循环。 阅读全文
posted @ 2013-09-18 14:59 不懂编程的程序员 阅读(539) 评论(0) 推荐(0) 编辑
摘要: 一、代码 1 //字符串比较 2 #include 3 using namespace std; 4 int mystrcmp(char s1[],char s2[]) 5 { 6 int i=0; 7 while(s1[i]==s2[i]&&s1[i]!=0&&s2[i]!=0) 8 i++; 9 int m=s1[i]-s2[i];10 if(m0)15 cout>a;24 cout>b;26 mystrcmp(a,b);27 }二、运行 阅读全文
posted @ 2013-09-18 14:34 不懂编程的程序员 阅读(245) 评论(0) 推荐(0) 编辑