I seem to get compile error whenever I include <string>. I am sure that I have used it before, has something changed?
Thx.
Peter
#include <string>
Moderator: Board moderators
Code: Select all
#include <iostream>
#include <set>
#include <string>
using namespace std;
set<string> words;
string word;
string inword;
void add() {
int j = 0;
word.clear();
for(int i = 0; i < inword.size(); i++) {
if(inword[i] >= 'A' && inword[i] <= 'Z')
inword[i] += 'a' - 'A';
}
while(inword[j] < 'a' || inword[j] > 'z')
j++;
while(inword[j] >= 'a' && inword[j] <= 'z'){
word.push_back(inword[j]);
j++;
}
words.insert(word);
return;
}
int main() {
while(cin>>inword)
add();
for(set<string>::iterator itr = words.begin(); itr != words.end(); itr++)
cout<<*itr<<"\n";
return 0;
}
Peter
Code: Select all
word.clear();