this is a function i am trying to write so that i can set up a vector for a flag operation to make sure i don't process the same letter of a string twice. i do understand variables(well i thought i did) from what i know if a variable is declared at the begginning of the function, then it should be available throughout the entire function right? could someone please look at my code and tell me where i am going wrong please? I could use another global vector but as i read everywhere, its best to keep globals to a minimum!
Thanks for your time!
using namespace std;
extern vector <string> words;
vector <int> flag; // *****i want this local to this function
// if i put flag.pushback(0) here this works fine!
cout << endl << "Error! Cannot load word file! Please reinstall!" << endl;
cout << endl << temp;
cout << endl << int(words.size()) << endl;
cout << int(words.length()) << endl;
cout << "lets try to jumble a word at random" << endl;
cout << "You see the list.... Pick one! ";
cin >> test ;
int lengthofstring = int(words[test].length());
for (int fil = 0; fil < lengthofstring ; fil++)
flag.pushback(0) ; //*** this is the line where it doesn't recognise 'flag' as a vector
for (int loop = 0 ; loop < lengthofstring ; loop++)