#include "stdafx.h"
#include <iostream>

using namespace System;
using namespace std;
int main(array<System::String ^> ^args)
{
char str[]="how    a re   you   ?";
int i,j;
while(str[j]!='\0')
{
if(str[j]!=' ')
{
        str[i++]=str[j++];
}
else
{
str[i++]=str[j++];
while(str[j]==' ')
{
j++;
}
}
}
str[i]='\0';
cout<<str<<endl;
    return 0;
}
程序编写过程中出现的问题:
char *pstr 与char str[]不同,利用pstr遍历字符串就要用pstr++,不能用pstr[i];