게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
c언어 에러 질문좀요 ㅠㅠ
게시물ID : programmer_12774짧은주소 복사하기
작성자 : 간장맛닭둘기
추천 : 0
조회수 : 526회
댓글수 : 10개
등록시간 : 2015/08/17 14:09:12
 fatal error: utility: No such fild or directory 라고 뜨네요
헤더파일이 없는거 같은데 어떻게 해야 되죠? 유틸말고 알고리즘으로 해도 똑같네요..
제가 학생이라 학원에서는 항상  visual c++쓰다가 집에서 처음 codeblocks쓴건데 뭐가 뭔지도 잘 모르겠어요...
아래는 코딩 한건데 하도 엉망진창이라 에러 한 수십개 뜰 것 같네요..
codeblocks으로파일 입출력 방법도 모르겠는데 가르쳐주시면 감사하겠습니다
#include <stdio.h>
#include <utility>
int rand_num;
int min;
int n=5;
int m=15;
pair <int,int> b[6];
pair <int,int> c[15];
int a[102][102];
int life[6]={0,3,3,3,3,3}
int f(int q,int p)
{
    int x=q;
    int y=p;
    int i,j;
    int k;
    int min=10000;
    for(i=1 ; i<=100 ; i++)
    {
        for(j=1 ; j<=100 ; j++)
        {
            if(a[i][j]>0 && a[i][j]<=n)
            {
                if(abs(i-x)>abs(j-y))
                {
                    k=abs(i-x);
                }
                else
                {
                    k=abs(j-y);
                }
                if(k<min)
                    min=k;
            }
        }
    }
    return min;
}
void process(void)
{
    int i,j,k,l,t;
    int x,y;
    int ma;
    for(i=1; i<=n ; i++)
    {
        b[i].first=1;
        b[i].second=3*i;
        a[1][i]=i;
    }
    for(j=1 ; j<=m ; j++)
    {
        c[i].first=2;
        c[i].second=j;
        c[10][j]=n+j;
    }
    for(i=0; i<=101 ; i++)
    {
        for(j=0; j<=101 ; j++)
        {
            if(i==0 || j==0 || i==101 || j==101)
            {
                a[i][j]=-1;
            }
        }
    }
    while(n!=0 || m!=0)
    {
        for(i=1; i<=100 ; i++)
        {
            for(j=1 ; j<=100 ;j++)
            {
                if(a[i][j]!=0)
                {
                    if(a[i][j]<=n)
                    {
                        for(k=i-n ; k<=i k++)
                        {
                            for(l=j-m ; l<=j+m ; j++)
                            {
                                if(a[k][l]>n)
                                {
                                    printf("%d %d ",a[k][l],c[a[k][l]-n].second);
                                    a[k][l]=a[i][j];
                                    a[i][j]=0;
                                    m--;
                                }
                                else
                                {
                                    life[a[i][j]]--;
                                    if(life[a[i][j]]==0)
                                    {
                                        a[i][j]=0;
                                        printf("%d %d ",a[i][j],b[a[i][j]].second);
                                        n--;
                                    }
                                    else
                                    {
                                        here;
                                        rand_num=rand();
                                        if(i+rand_num%b[a[i][j]].second*(-1)^rand_num>100 || j+rand_num%b[a[i][j]].second*(-1)^rand_num>100||i+rand_num%b[a[i][j]].second*(-1)^rand_num<1 || j+rand_num%b[a[i][j]].second*(-1)^rand_num<1
                                           ||a[i+rand_num%b[a[i][j]].second][j+rand_num%b[a[i][j]].second]!=0)
                                           goto here;
 
                                        else
                                        {
                                            a[i+rand_num%b[a[i][j]].second][j+rand_num%b[a[i][j]].second]=a[i][j];
                                            a[i][j]=0;
                                        }

                                    }

                                }
                            }
                        }
                    }
                    else
                    {
                        ma=f(i,j);
                        for(k=i-c[a[i][j]-n].second ; k<= i+c[a[i][j]-n].second ; k++)
                        {
                            for(l=j-c[a[i][j]-n].second ; l<= j+c[a[i][j]-n].second ; l++)
                            {
                                if(ma<f(k,l)&&a[k][l]==0)
                                {
                                    x=k;
                                    y=l;
                                }
                            }
                        }
                        a[k][l]=a[i][j];
                        a[i][j]=0;
                    }

                }
            }
        }
        printf("\n");

    }
}
int main(void)
{
    process();
    return 0;
}
 
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호