Dear All
I am trying to create a list of characters already given as below.
When I compile it it gives me following errors.
In function `int main()':
17: error: `islowerCase' undeclared (first use this function)
17: error: (Each undeclared identifier is reported only once for each function it appears in.)
18: error: a function-definition is not allowed here before '{' token
18: error: expected `,' or `;' before '{' token
19: error: `ostream_iterator' undeclared (first use this function)
19: error: expected primary-expression before "char"
19: error: expected `;' before "char"
20: error: `screen' undeclared (first use this function)
listChar.cc:54:2: warning: no newline at end of file
--I would be very happy if someone could help me!
regards
juniper
main()
{
vector<string> listChar;
vector<char> lastElem;
lastElem = remove_if(listChar.begin(), listChar.end(),islowerCase); // Line 1
bool islowerCase(char c) { return islower(c); }
ostream_iterator<char> screen(cout,""); // Line 2
copy(listChar.begin(), lastElem, screen); // Line 3
listChar.push_back("w");
listChar.push_back("W");
listChar.push_back("b");
listChar.push_back("B");
listChar.push_back("C");
listChar.push_back("E");
listChar.push_back("w");
listChar.push_back("F");
listChar.push_back("B");
listChar.push_back("m");
cout << " "<< endl;
cout << "Loop by index:" << endl;
int ii;
for(ii=0; ii < listChar.size(); ii++)
{
cout << listChar[ii] << endl;
}
cout << endl << "Reverse Iterator:" << endl;
vector<string>::reverse_iterator rii;
for(rii=listChar.rbegin(); rii!=listChar.rend(); ++rii)
{
cout << *rii << endl;
}
cout << endl << "The Number of Characters:" << endl;
cout << listChar.size() << endl; cout << listChar[10] << endl;
swap(listChar[0], listChar[10]);
cout << listChar[10] << endl;
}