i get illegal operation.

This is a discussion on i get illegal operation. within the C++ Programming forums, part of the General Programming Boards category; im new in C++
this is only a sample code:
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main ...

note: the text with red font is the coz of "illegal operation" but if i change it to a same variable i dont recieve illegal operation but whenever line 14 is executed both variable b and a change to the value from the document.

this is the problem if i use same variable to line 11 and 14:
i change the variable c to d from line 11.

ab>>d;
b=d; meaning if string from the word.txt is aaaa, b = "aaaa"
when line 14 is executed
ab>>d;
a=d; if string from wordlist.txt is bbbb supposed to be a= "bbbb"
but b is also become b= "bbbb"