I am going through Bjarne Stroustrup's book and I have encountered a problem that i cannot solve. I get a lot of errors. I know I messed it up. I would really appreciate if someone could look at it a bit to see if they can help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#include "P:\C++\Exercitii si Drills\Drills\pg . 75\std_lib_facilities.h"
using namespace std;
int main()
{
vector<string> dislike = {"Dislike", "Alike", "Hello", "Water"}
vector<string> words;
cout << "Please enter some words.\n";
for(string word;cin >> word;)
words.push_back(word);
sort(words);
for(int i=0; i<words.size(); ++i ){
if(i==0 || words[i-1]!==words[i]){
if(words[i]!=dislike[i]){
cout << words[i] << '\n';
else
cout << "BLEEP" '\n';
}
}
}
cout << words.vector;
}
|
Line 15: error: "words" was not declared in this scope
Line 17: error: "words" was not declared in this scope
Line 21: error: expected primary-expression before '=' token
Line 26: error: expected '}' before 'else'
Line 27: error: expected ';' before '\xa'
Line 31: error: 'cout' does not name a type
Line 34: error: expected declaration before '}' token
One more, it has something to do with std_lib_facilities.h:
Line 352: error: exprected',' or ';' before 'Vector'