inserterror:-'w' undeclared( first use this function )Code:#include<iostream> #include<conio.h> #include<string.h> using namespace std; class dic { char w[5][10]; char m[5][10]; char a[5][10]; public: dic(); void search(); void setpos(int); void disrecsea(); void display(); }; int j=0; dic::dic() { strcpy(w[0],"first"); strcpy(w[1],"second"); strcpy(w[2],"third"); strcpy(w[3],"fourth"); strcpy(w[4],"fifth"); strcpy(m[0],"1"); strcpy(m[1],"2"); strcpy(m[2],"3"); strcpy(m[3],"4"); strcpy(m[4],"5"); strcpy(a[0],"6"); strcpy(a[1],"7"); strcpy(a[2],"8"); strcpy(a[3],"9"); strcpy(a[4],"10"); } void dic::search() { int i; char word[10]; cout<<"\n Enter the word = "; cin>>word; for(i=0;i<5;i++) { if(stricmp(word,w[i])==0) { cout<<"\n Meaning = "<<w[i]; cout<<"\n Antonym = "<<a[i]; setpos(i); } } if(i==5) cout<<"\n NOT FOUND "; } void setpos(int i) { char ch[10]; strcpy(ch,w[j]); // this is where i am getting error strcpy(w[j],w[i]); strcpy(w[i],); strcpy(ch,a[j]); strcpy(a[j],a[i]); strcpy(a[i],ch); strcpy(ch,m[j]); strcpy(m[j],m[i]); strcpy(m[i],ch); j++; } void dic::disrecsea() { cout<<"\n Recent searches \n"; if(j==0) cout<<"\n No recent searches"; for(int i=0;i<j;i++) { cout<<"\n Word = "<<w[i]; cout<<"\n Meaning = "<<m[i]; cout<<"\n Antonym = "<<a[i]; getch(); } } void dic::display() { for(int i=0;i,5;i++) { cout<<"\n Word = "<<w[i]; cout<<"\n Meaning = "<<m[i]; cout<<"\n Antonym = "<<a[i]; getch(); } } int main() { char choice; dic o1; top: search(); disrecsea(); display(); cout<<"\n Do you want to continue(y/n) = "; cin>>choice; if(choice=='y'||choice=='Y') goto top; return 0; }
how to resolve???????