I try to fix it,but i can't Please help me!!

Hi,I am Really new in C++. I'm trying to write a program which search word from text file and display matched word whole lines. Can any body help me out please?

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{   int i;

    char word[30];
    char text[50];
    fstream dict("bufferfile.txt",ios::in);

    if (!dict.is_open())
    { 
        cout << "Unable to open file";
        system("pause");
        exit(1);
    }
    cout<<"Enter word to search \n";
    cin>>word;

    loop:
            i=0; 
    while(dict.getline(text,50))
    {
     while((word[i]!='\0')&&(text[i]!='\n'))
    { if(word[i] != text[i])
    {
              goto loop;}
                 else 

        cout<<text<<endl;


        }
}   ++i;
system("pause");
    return 0;
}

A list of things to do:
Use code tags, realize you're programming in C++ not BASIC avoid goto , avoid system() whenever possible(it's slow, often unportable, and insecure in some cases), and reformat your code because someplaces look like errors but I can't tell.

Yes it some Error occured but i don't know hoe to deal with it.
If you know please help me,,thank you so much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.