69,369
社区成员
发帖
与我相关
我的任务
分享
#include "StdAfx.h"
#include"stdio.h"
#define MAX_LENGTHE 200
void main()
{
int nCount = 0;
char cS[MAX_LENGTHE];
char* p = cS;
printf("Please input the source string\n");
gets( cS );
if ( p != '\0' && ('a' <= *p && *p<= 'z' ))
{
*p -= 32;
}
p++;
while ( *p != '\0' )
{
if ( *p == ' ')
{
nCount++;
}
else if ( 65 <= *p && *p <= 90 )
{
*p += 32;
}
p++;
}
printf( "The space count is %d\n", nCount );
printf( "The dest string :%s\n", cS);
}