下边内容是关于 C++ 求字符串最长连续字符的长度的内容.
- #include<assert.h>
- {
- assert(s!=NULL);
- int temp_count,final_count=0;
- p=s;
- {
- temp_count=0;
- {
- temp_count++;
- else
- break;
- }
- if(temp_count>final_count)
- {
- final_char=temp_char;
- final_count=temp_count;
- }
- }
- return final_count;
- }
- void main()
- {
- char s[]="aabbbcccc";
- int count;
- char c;
- count=get_max_char_count(s,&c);
- printf("%c is appeared %d timesn",c,count);
- }
来源: http://www.bubuko.com/infodetail-2872945.html