Dictionary Concepts in C++


#include<iostream.h>
#include<stdio.h>
#include<string.h>
#include<conio.h>
class dic
{
public:
void di(char *a)
{
FILE *f;
f=fopen("FIL.TXT","r");
while(!feof(f))
{
if(fgetc(f)=='\n')
{
char te[20];
fscanf(f,"%s",te);
if(strcmp(te,a)==0)
{
char ch=fgetc(f);
while(ch!='\n')
{
cout<<ch;
ch=fgetc(f);
}
return;
}
}
}
cout<<"Not Found";
}};
void main()
{
dic d;
char g[30];
cout<<"Enter the word:";
cin>>g;
d.di(g);
getch();
}

0 comments: