Hi Everybody,
If someone could help me with this problem, I would really appreciate it. I'm a newbie and trying to finish an assignment. I've gotten stuck on one thing and can't seem to find a way out of it. I've already done the searches and spent at least 5-6 hours on this little problem alone. I imagine it's something easy to solve for you guys:
In the code below, every thing works fine until I try to increment the 'k' variable (trying to read through a string character by character). Then I get the following warning:
Expression: string subscript out of range
Does anybody know what I can do to solve this?
int main()
{
string keyword;
int check;
int i=0;
int k=0;
char abcd[ARRAY_SIZE] = "ABCDEFGHIJKLMNOPQRSTUVWXY";
ifstream infile;
ofstream outfile;
infile.open ("C:\\Users\\achirri\\Documents\\MP6proj.txt");
outfile.open ("I:\\C++\\MP6proj.txt");
infile >> keyword;
char passkey[ARRAY_SIZE];
for(i = 0; i < ARRAY_SIZE; i++)
{
k++;
check = check_passkey(passkey, ARRAY_SIZE, keyword[k]);
if (check == 0)
passkey[i] = keyword[k];
abcd_erase(abcd, keyword[k], ARRAY_SIZE);
}