新人学习
想要在文件中找到自己输入的东西用c++做,并且输出结构体里的其他成分
程序代码: ifstream infile ("D:\\xxxx\\Desktop\\xxxx.txt");
if (!infile) {
cout << "openfile error";
return -1;
}
char ch;
while (infile.get (ch) ) {
if (ch != '\n')
cout << ch << endl;
else
cout << "换行";
}
string str;
while (getline (infile, str) ) {
if (str.find ( "str" ) != -1)
cout << "found str";
}








