回复 10楼 mxs810
那还有什么类型是和String一样支持长度可变的字符输出呢?
程序代码:#include<iostream>
#include <cstring>
#include<cctype>
using namespace std;
int main()
{
char user[100];
//string user;
cout<<"Input a sentence, Spaces into ^"<<endl<<endl;
cin.getline(user,100);
user[0]=toupper(user[0]);
for (int sign=1;sign!=100;sign++)
{
if((user[sign] == '.') || (user[sign] == '?') || (user[sign] == '!')|| (user[sign] == ';') || (user[sign]==' '))
{
user[sign + 1] = toupper(user[sign + 1]);
}
/* if(user[sign]=='^')
{
user[sign]=' ';
} */
}
cout<<endl<<user<<endl<<endl;
return 0;
}









