Hi!
Please check out the code below.
The problem is that the if-statement doesn’t detect it when input and wrdCode:#include<iostream> #include<string> #include<fstream> using namespace std; void main() { char input[20]="\0\0"; cout<<"English word?: "; cin>>input; ifstream fs; char let[2]="\0"; char wrd[20]="\0\0"; int i=0; fs.open("lib.txt", ios::in); while(fs.peek()!='.') //check word end { fs.read(let,1); wrd[i] = let[0]; //create word i++; } if(input==wrd) { cout<<wrd; } }
seems to contains the same string. Please show me my fault.
Thanks in advance.
-geek@02