Reputation:
I have following code
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string d="georgia is nice country":
string::iterator my;
for (my=d.begin();my!=d.end();my++) {
cout<<*my<<endl;
}
return 0;
}
but it causes a compiler error saying "my is undefined". What is wrong?
Upvotes: 0
Views: 71
Reputation: 52159
You need to put a semicolon instead of a colon after the string.
string d="georgia is nice country"; // <-- semicolon!
Upvotes: 1
Reputation: 109119
string d="georgia is nice country"; // <-- semicolon, not colon
Upvotes: 1