now i am facing a problem where i want to compare the keyword input from the user with the string that read from file.
this is a part of my codding that with error,
Expand|Select|Wrap|Line Numbers
- int position,py;
- char keyPrompt[100];
- input.open("a.dat");
- if (input.fail())
- {
- cout<<"Unable to open a file \n";
- exit(1);
- }//end if
- while(input>>alpha>>index)
- {
- Alpha[a].setkeyword(keyword);
- Alpha[a].setindex(index);
- a++;
- }//end while
- input.close();
- cout<< enter keyword:";
- cin>>keyPrompt;
- for(py=0; py<a; py++)
- { //compare the first alphabet with the alphabet in file
- if(strcmp(keyPrompt[0],Alpha[py].getkeyword())==0)
- {//alphabet match
- position=py; //position in alpha array
- break;
- } //end if
Expand|Select|Wrap|Line Numbers
- strcmp(keyPrompt[0],Alpha[py],getkeyword())