Vector, rus sumbols
Hello world. =)
I have:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
#include <iostream>
#include <vector>
#include <string>
using namespace std;
bool main()
{
setlocale(LC_ALL, "Russian");
vector<string> vect;
while (!cin.eof())
{
string temp;
cin.ignore();
getline(cin, temp);
vect.push_back(temp);
}
for (vector<string>::iterator iter(vect.begin()); iter != vect.end(); ++iter)
cout << *iter << endl;
}
|
how received on an output string, with russian sнmbols? not drivel.
p.s. sorry for my english =)
The main() function must be int, not boolean. As for your problem: if your computer supports Russian characters, it will work.
By the way statements
1 2 3
|
for (vector<string>::iterator iter(vect.begin()); iter != vect.end(); ++iter)
cout << *iter << endl;
}
|
can be more simpler if to use the range based for statement
for ( const auto &s : vect ) cout << s << endl;
yep: int main()...
1 2 3 4 5
|
string tmp("рус");
cout << tmp << endl; // successful work
vect.push_back(tmp);
vector<string>::iterator iter = find(vect.begin(), vect.end(), tmp);
cout << *iter << endl; // he out drivel
|
Topic archived. No new replies allowed.