#include<stdio.h> main() { char string[100]; int index,word=1; char blank; gets(string); if(string[0]=='\0') { printf("there is no char!\n"); } else if(string[0]==' ') { printf("first char just is a blank!\n"); } else { for(index=0;string[index]!=0;index++) { blank=string[index]; if(blank==' ') { word++; } printf("%d\n",word); } return 0;  } 
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄