我希望代码能够搜索单词中间句子,并查看它的第一个字母是小写字母。与大写和小写相关的C++帮助
如果是这样,那么它就是大写。例如:约翰讨厌每天使用C++,它会将C++中的C改为大写。
下面是代码
#include <iostream>
#include <string>
#include<cstdlib>
#include<fstream>
using namespace std;
ifstream in_stream;
ofstream out_stream;
int main()
{
in_stream.open("in.dat");
out_stream.open("out.dat");
char s[256];
in_stream>>s;
s[0] = tolower(s[0]);
out_stream<<s;
in_stream.close();
out_stream.close();
system("Pause");
return 0;
}
这是雁在这里被 http://stackoverflow.com/questions/313970/how-to- convert-stdstring-to-lower-case – teivaz
为什么代码中存在空白链接?没有缩进?你为什么使用'char'数组? –
@teivaz没有提及如何找到字符串的中间部分...但我确定这是一个不同的答案 –