私はC++の初心者ですが、以下のプログラムは非常に簡単ですが、 "EXIT"を入力すると、プログラムが終了します。breakプログラムを終了する - C++
ここにコードは次のとおりです。事前に
#include <iostream>
#include <string>
#include <set>
using namespace std;
int main()
{
set <string> myset;
set <string> :: const_iterator it;
it = myset.begin();
string In;
int i=1;
string exit("EXIT");
cout << "Enter EXIT to print names." << endl;
while(1)
{
cout << "Enter name " << i << ": " ;
cin >> In;
if(In == exit)
break;
myset.insert(In);
In.clear();
i++;
}
while(it != myset.end())
{
cout << *it << " " ;
it ++ ;
}
cout << endl;
}
感謝。
ありがとうございました:) – Nour