16,548
社区成员




RemoveBlankperiod(char c[])
{
char *p =c,*q;
char tem[3];
memset(tem, 0, sizeof(tem));
int nLength = strlen(c);
static int nLen = nLength;
int j = 0;
for (int i = 0; i < nLength - 1; i++)
{
memcpy(tem, &c[i], 2);
if (strcmp(tem, "。"))
{
p++;
}
else
{
q = p;
nLen -= 2;
j = 0;
while (j < nLen)
{
*q = *(q+2);
q++;
j++;
}
p++;
*q ='\0';
}
}
return 0;
}
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
char a[] = "海口.。.。";
cout << a << endl;
char tem[3];
char szFinal[1024];
memset(tem, 0, sizeof(tem));
memset(szFinal, 0, sizeof(szFinal));
//cout << sizeof(szFinal) << endl;
/*cout << tem << endl;*/
int nLength = strlen(a);
int j = 0;
for (int i = 0; i < nLength - 1; i++)
{
memcpy(tem, &a[i], 2);
//cout << tem << endl;
if (strcmp(tem, "。"))
{
memcpy(&szFinal[j], tem, sizeof(tem));
j++;
}
}
cout << szFinal << endl;
system("pause");
return 0;
}