由买买提看人间百态

topics

全部话题 - 话题: curword
(共0页)
l********a
发帖数: 1154
1
又来一次
#include
#include
#include
using namespace std;
int main()
{
ifstream fin("test.txt");
string curWord, lastWord = "";
fin >> curWord;
while (curWord.compare("end")!=0)
{
if (lastWord.empty())
{
cout << curWord << " COMES FIRST" << endl;
}
else if (curWord>lastWord)
{
cout << curWord << " AFTER " << lastWord << endl;
}
else if (curWord {
... 阅读全帖
l********a
发帖数: 1154
2
来自主题: Computation版 - 20个包子,求解c++基础问题 (转载)
是c++不是c吧,那用string吧,别用char了
#include
#include
#include
using namespace std;
int main()
{
ifstream fin("test.txt");
string curWord, lastWord = "";
fin >> curWord;
while (curWord.compare("end")!=0)
{
if (lastWord.empty())
{
cout << curWord << " COMES FIRST" << endl;
}
else if (curWord>lastWord)
{
cout << curWord << " AFTER " << lastWord << endl;
}
else if (curWord阅读全帖
(共0页)