Lv 1110 points

Vinod

Favorite Answers0%
Answers4
  • Dictionary using c++. Please anyone help me to?

    Here is my c++ program. Due to some errors i dont got the desired result. Help me please.

    #include<fstream.h>

    #include<conio.h>

    #include<stdio.h>

    #include<process.h>

    class dictn

    {

    int d,i,beg,end,fsize,z;

    char w[10],c;

    ofstream fout("DICT.DAT",ios::binary|ios::app);

    ifstream fin("DICT.DAT",ios::binary);

    struct dictionary

    {

    char word[10],meaning[90];

    }dicts[500];

    public:

    dictn();

    void main_menu();

    void dictn_display();

    void build();

    void about();

    int search(char[]);

    void reload();

    void esc();

    }

    dictn::dictn()

    {

    beg=fin.tellg();

    fin.seekg(0,ios::end);

    end=fin.tellg();

    fsize=(end-beg)/100;

    fin.seekg(0);

    }

    void dictn::reload()

    {

    for(i=0;i<fsize;i++)

    {

    fin.read(dicts[i].word,10);

    fin.read(dicts[i].meaning,90);

    }

    }

    void esc()

    {

    fin.close();

    fout.close();

    exit(0);

    }

    void dictn::main_menu()

    {

    clrscr();

    cout<<"--------------- DICTIONARY ---------------";

    cout<<"\nSelect your Choice\n1.Dictionary\n2.Builder\n3.About\n4.Quit";

    cin>>z;

    switch(z)

    {

    case 1:

    dictn_display();

    break;

    case 2:

    build();

    break;

    case 3:

    about();

    break;

    case 4:

    esc();

    break;

    }

    }

    void dictn::dictn_display()

    {

    cout<<"\nEnter the Word to be searched\n";

    cin>>w;

    d=search(w);

    if(d>0)

    {

    cout<<"\n"<<dicts[d].meaning;

    }

    else

    cout<<"\nSearch Word Not found\n";

    }

    int dictn::search(char word[10])

    {

    for(i=0;i<500;i++)

    {

    if(word==dicts[i].word)

    {

    return i;

    break;

    }

    }

    return -1;

    }

    void dictn::build()

    {

    do{

    dictionary *dict=new dictionary;

    cout<<"Enter the Word\n";

    gets(dict->word);

    cout<<"\nEnter "<<dict->word<<"'s meaning\n";

    gets(dict->meaning);

    fout.write((char*)dict,sizeof(dictionary));

    delete dict;

    cout<<"\nDo you want to enter More? (y/n)\n";

    cin>>c;

    }while(c!='n');

    }

    void dictn::about()

    {

    cout<<"\nDictionary created by\n";

    }

    void main()

    {

    }

    1 AnswerWords & Wordplay8 years ago
  • What is wave nature and particle nature?

    I heared about dual nature of matter from my physics book. But i don't understood about wave nature and particle nature. So please some one explain about these

    3 AnswersPhysics8 years ago