脚踏实地,仰望星空,以梦为马,不负韶华
/*教程例码:5.17 字符串中字符可通过对应下标方式灵活使用 一个句子中也许有多个连续空格,过滤掉多余空格只保留1个间隔空格*/ #include<iostream> #include<cstdio> #include<cstring> using namespace std; char st[200]; int main(){ gets(st);//向一个字符数组中输入一个字符串(含空格) for(int i=0;i<strlen(st);++i)cout<<st[i]; return 0; }