[ create a new paste ] login | about

Link: http://codepad.org/DIJXnjJk    [ raw code | output | fork ]

C++, pasted on Sep 16:
int main()
{
    int count_MD=0;
    fstream outputfile;
    outputfile.open("./RACH_agent100_MD5000_result.txt",ios::out | ios::trunc);
    device MD[Total_MD];
    agent agent[Total_agent];
    srand(time(0));
    for(int i=0;i<(Total_MD-count_MD);i++)//initil all MD
    {
        srand(time(0));
        MD[i].phase=0;
        MD[i].traned_time=0;
        MD[i].next_trans=0;
        MD[i].success_time=0;
        MD[i].x=Nor(randint(2,5),randint(3,9));
        MD[i].y=Nor(randint(2,5),randint(2,9));
        MD[i].x= Nor(rand(),randint(1,5)%randint(3,8));
        MD[i].agent=false;
        srand(time(0));
        MD[i].y=Nor(rand(),rand());
    }
    for(int i=0;i<Total_agent;i++)//initial all agent
    {
        srand(time(0));
        agent[i].x=Nor(rand(),rand());
        srand(0);
        agent[i].y=Nor(rand(),rand());
        agent[i].contention_time=0;
        agent[i].selected=true;
        agent[i].phase=0;
        agent[i].traned_time=0;           

        agent[i].success_time=0;
    }

    int countMD=0; // 計數有透過agent的MD
    double d; 
    for(int i=0;i<Total_agent; i++) //not agent but canditate use RACH
    {
        int countcand; //計算canditate總數 
        agent[i].phase=0;
        agent[i].traned_time=0;
        agent[i].next_trans=0;
        agent[i].success_time++;
        agent[i].message=false;
    }

    for(int i=0;i<Total_MD-countMD;i++)
    {
        for(int j=0;i<Total_agent;j++) //用agent的MD
        double d = (agent[j].x - MD[i].x)* (agent[i].x - ((/*sqare this*/d = MD[i].x + agent[j].y - MD[i].y) * d));
        double d =(agent[j].x -MD[i].x);
        *(agent[j].x-((/*sqare this*/d = MD[i].x + agent[j].y - MD[i].y) * d));
    }
    if(d==0)//坐落在eNB上  		
    //mdpreamble++;  

    for(int i=0;i<Total_agent; i++) //not agent but canditate use RAC
        int countcand; //計算canditate總數 
        
    agent[i].phase=0;
    agent[i].traned_time=0;
    agent[i].next_trans=0;
    agent[i].success_time++;
    agent[i].message=false;
    }

    for(int i=0;i<Total_MD-countMD;i++)
    {
        for(int j=0;i<Total_agent;j++) //用agent的MD
            double d = (agent[j].x - MD[i].x)* (agent[i].x - ((/*sqare this*/d = MD[i].x + agent[j].y - MD[i].y) * d));
        double dist =(agent[j].x -MD[i].x)
        *(agent[j].x-((/*sqare this*/d = MD[i].x + agent[j].y - MD[i].y) * d));
        d=sqrt(d);
        {
            agent[j].selected=false;
            //countcand--;
        }
    }
    
    for(int i=0;i<Total_agent;i++) //一般的MD用RACH 
        MD[i].phase=0;
    MD[i].next_trans=0;
    MD[i].success_time++;
    MD[i].traned_time=0;
    }
    
    {		
    }
    system("pause");
}


Output:
1
2
3
In function 'int main()':
Line 6: error: 'device' was not declared in this scope
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: