It's odd....every attempt I've made at vectors with this code has worked, except this one. I'm really not seeing what's wrong with it.
[I]Dev-C++ Error Report[/I}
D:\Dev-Cpp\vectors.cpp In function `int main(int, char**)':
13 D:\Dev-Cpp\vectors.cpp invalid conversion from `const char*' to ` char'
13 D:\Dev-Cpp\vectors.cpp initializing argument 1 of `void std::basic_string<_CharT, _Traits, _Alloc>:ush_back(_CharT) [with _CharT =
...
16 D:\Dev-Cpp\vectors.cpp no `operator++(int)' declared for postfix `++ ', trying prefix operator instead
16 D:\Dev-Cpp\vectors.cpp no match for 'operator++' in '++ vstr_Inventory'It's odd...I don't see what's wrong with vstr_Inventory[0].push_back("string here.."); I tried taking out the spaces if it didn't like that(even if the errors said otherwise, seems to work sometimes), but of course to no avail. Those errors are just too cryptic for me, and I don't see how it wants a const char...isn't that what I'm giving it? o_0Code:///**********************************************************/// /*********************VECTOR-EXPERIMENTS***********************/ ///**********************************************************/// // Project: Vector-Experiments // Compiler: Mingw Port of GCC // IDE: Dev-C++ 4.9.9.0 // Operating System: Win Pro CE // File: main.cpp // Description: An attempt to write an inventory script, this is just // example code from the original file, but all the code is the // same anyways besides the vector size. #include <iostream> #include <vector> #include <string> using namespace std; int main(int argc, char **argv) { //Vector size is normally 10, but reduced to 3 for speed / // demonstration purposes. vector<string> vstr_Inventory(3); vector<string>::iterator iter_vstr_Inventory = vstr_Inventory.begin(); vstr_Inventory[0].push_back("Sacrament of the Dead"); vstr_Inventory[1].push_back("Revealing Light"); vstr_Inventory[2].push_back("Revitalizing Flask"); for(iter_vstr_Inventory; iter_vstr_Inventory <= vstr_Inventory.end(); vstr_Inventory++) { std::cout << "The item in slot x is:" << *iter_vstr_Inventory; } system("pause"); return 0; }