I'm trying to get the user to input 10 word's one at a time and store them in
a string vector as they are entered. The biggest problem so far has been using a variable to point to the next location in the vector.
After several attempt's this is the closest i've got (1 error).
The error i'm getting is:
G:\DCSTemp\Vector Exercises - Copy\main.cpp|13|error: 'i' was not declared in this scope|||=== Build finished: 1 errors, 0 warnings (0 minutes, 0 seconds) ===|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
int main()
{
std::vector<std::string> StrVec (10);
std::string input;
std::cout << "Enter 10 word's one at a time.\n";
for (int i = 0; (i = (StrVec.size() -1)); ++i);
{
std::cout << "Enter word " << i + 1 << " ";
std::cin >> input;
std::vector<std::string> StrVec[i] = input;
}
}