today i was solving this problem
http://acm.uva.es/p/v101/10189.html
and i after i solve it i compile it with Microsoft Visual Studio 6 and
i've got the results
correct but
after i send it to Valladolid judge it say it has a compiler error!!! o
my god
anyway need your helps
tanx in advance
------
/*
       problem No. 10189 of the Valladolid

        the problem gets input as a mine field
        it gets mine fields in this way
        first it gets two numbers that first integer is number of lines
        the second integer is number of columns  and the program stops when
        the user inputs these both two numbers 0

        after getting this N and M it gets a N*M matrix of characters
        in this matrix the character '*' defines a mine and character '.'
        define empty space

    Output :
        Field #Number of field that is going to being processed
        next lines is a M*N matrix that '*' characters will apear in the
output
        exactly like inputs and instead of empty space we put numbers in those
        cells the numbers define numbers of mines cross that cell
        obviously the minimum is 0 and the Maximum could be is 8
*/

#include <iostream.h>

void checker(int f1[][100],int m,int n)
{
        int Currtemp = 0; // Number of mines across the current cell should
being zero at first of counting for each cell
        for(int i=1;i<=m;i++)
        {
                for(int j=1;j<=n;j++)
                {
                        Currtemp  = 0;

                        if(f1[i][j]!=-1)
                        {
                                if(f1[i-1][j-1] == -1) //1
                                        Currtemp++;
                                if(f1[i-1][j] == -1) //2
                                        Currtemp++;
                                if(f1[i-1][j+1] == -1) //3
                                        Currtemp++;
                                if(f1[i][j-1] == -1) //4
                                        Currtemp++;
                                if(f1[i][j+1] == -1) //5
                                        Currtemp++;
                                if(f1[i+1][j-1] == -1) //6
                                        Currtemp++;
                                if(f1[i+1][j] == -1) //7
                                        Currtemp++;
                                if(f1[i+1][j+1] == -1) //8
                                        Currtemp++;
                                f1[i][j] = Currtemp;
                        }


                }
        }
}

int main()
{
        int RawField[100][100] = {0}; // Our raw mine field
        int field[100][100] = {0}; // Our mine field
        int NOF = 0; // Number of Current field
        int m = 0; // Number of lines
        int n = 0; // Number of columns

        char temp; //this help us to convert chars to int
        cin>>m>>n;

        while((m!=0)||(n!=0))
        {
                NOF++;
                for(int i=0;i<100;i++)
                {
                        for(int j=0;j<100;j++)
                                RawField[i][j] = 0;
                }

                for(i=1;i<=m;i++)
                {
                        for(int j=1;j<=n;j++)
                        {
                                cin>>temp;
                                if(temp=='*')
                                {
                                        RawField[i][j] = -1;
                                }
                        }
                }
                cout<<"Field #"<<NOF<<":"<<endl;
                checker(RawField,m,n);

                for(i=1;i<=m;i++)
                {
                        for(int j=1;j<=n;j++)
                        {
                                if(RawField[i][j] !=-1)
                                        cout<<RawField[i][j];
                                else
                                        cout<<'*';
                        }
                        cout<<endl;
                }
                cout<<endl;
                cin>>m>>n;
        }
        return 0;
}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to