Is it me, or is my computer a bitch when it comes to compiling?

Discussion in 'Programming' started by The Bard, Nov 8, 2006.

  1. #1
    When I run this code for improvised BFD in Dev C++ by Bloodshed, it just breaks and the infamous "don't send" window appears. Is there a mistake I can't find, or is there a problem in my Computer?

    #include <iostream>
    using namespace std;
    int main (){
        int polje [10][10];        //defining a 10x10 array
        for (int i=0; i<10; i++)
            for (int j=0; j<10; j++)
            polje[i][j]=-1;
        int br1,prx,pry,br;  
        cout << "Unesite broj prepreka: " << endl;      // defining blocks by choice
        cin >> br1;
        cout << "Sada unesite koordinate svake prepreke u obliku x,y" << endl;
        br1=br;
        for(br; br<0; br--) {
                cin >> prx;
                cin >> pry;
                polje[prx][pry]=-2;
                }
        int ax,ay,bx,by;           // defining start and finish coords by choice
        cin >> ax,ay,bx,by;
        int kjux[100], kjuy[100];
        kjux[1]=ax;
        kjuy[1]=ay;
        int p,k,v;
        int prix,priy;
        p=1;
        k=1;
        do {
          int o=1;      
          for(p; v<=k; p++){
                   prix=kjux[p];
                   priy=kjuy[p];
          if (polje[prix+1][priy] == -1) 
             polje[prix+1][priy] = o;
          if (polje[prix-1][priy] == -1) 
             polje[prix-1][priy] = o;
          if (polje[prix][priy+1] == -1) 
             polje[prix][priy+1] = o;
          if (polje[prix][priy-1] == -1) 
             polje[prix][priy-1] = o;
             }
          for (int u=0; u<10; u++){
            for (int t=0; t<10; t++){
                if (polje[u][t]=o) {
                               kjux[o+1]=u;
                               kjuy[o+1]=t;
                               k=k+1;
          }
          }
          }      
          o=o+1; }
        while (p!=k);
        cout << polje[bx][by] << endl;
        
    }
    Code (markup):
    Thx in advance! :D
     
    The Bard, Nov 8, 2006 IP
  2. giraph

    giraph Guest

    Messages:
    484
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I have no idea what you're trying to do, try using variables that mean something or explaining what you're trying to do. You have a few compiler errors, I changed a couple things to prevent infinite loops but you really need to look at your code.
    
    #include <iostream>
    using namespace std;
    int main (){
        int polje [10][10];        //defining a 10x10 array
        for (int i=0; i<10; i++)
            for (int j=0; j<10; j++)
            polje[i][j]=-1;
        int br1,prx,pry,br;  
        cout << "Unesite broj prepreka: " << endl;      // defining blocks by choice
        cin >> br1;
        cout << "Sada unesite koordinate svake prepreke u obliku x,y" << endl;
        br = br1;
        for(br; br<0; br--) {
                cin >> prx;
                cin >> pry;
                polje[prx][pry]=-2;
                }
        int ax,ay,bx,by;           // defining start and finish coords by choice
        cin >> ax >> ay >> bx >> by;
        int kjux[100], kjuy[100];
        kjux[1]=ax;
        kjuy[1]=ay;
        int p,k,v;
        int prix,priy;
        p=1;
        k=1;
        do {
          int o=1;      
          for(p; p<=k; p++){
                   prix=kjux[p];
                   priy=kjuy[p];
          if (polje[prix+1][priy] == -1) 
             polje[prix+1][priy] = o;
          if (polje[prix-1][priy] == -1) 
             polje[prix-1][priy] = o;
          if (polje[prix][priy+1] == -1) 
             polje[prix][priy+1] = o;
          if (polje[prix][priy-1] == -1) 
             polje[prix][priy-1] = o;
             }
          for (int u=0; u<10; u++){
            for (int t=0; t<10; t++){
                if (polje[u][t]=o) {
                               kjux[o+1]=u;
                               kjuy[o+1]=t;
                               k=k+1;
          }
          }
          }      
          o=o+1; }
        while (p==k);
        cout << polje[bx][by] << endl;
    }
    
    Code (markup):
     
    giraph, Nov 8, 2006 IP
  3. The Bard

    The Bard Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sorry, all the variables are on croatian, I forgot to translate them, i translated only the infos, i apologize, but I just wanted to see 'bout those compiling errors, I think smthgn is wrong with my machine, cause I still can't run this program without it breaking.
     
    The Bard, Nov 9, 2006 IP
  4. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I also tried to figure out what was with this code and I could not succeed. I could compile it but the program crashed.

    The problem is not with your compiler or computer. The problem is with the code. Sadly, without fully understanding what you are trying to accomplish, I cannot see how to fis it.
     
    clancey, Nov 9, 2006 IP
  5. MolbO

    MolbO Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    some another changes in code revised by giraph
     

    Attached Files:

    MolbO, Nov 12, 2006 IP