


















不重复地输出升序数组中的元素。
1
void outputUnique( char [] str, int n) {
2
if (n <= 0 ) return ;
3
elseif(n == 1 ) putchar(str[ 0 ]);
4
else {
5
int i = 0 ,j = 1 ;
6
putchar(str[ 0 ]);
7
while (j < n) {
8
if (str[j] !== str[i]) {
9
putchar(str[j]);
10
i = j;
11
}
12
++ j;
13
}
14
}
15
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。