KakaoTalk_20190606_001802318.png
  • 246x0w
Welcome
Curriculum
Install&Go
Board
실제 작동 상태를 확인하려면 라이브 사이트로 이동하세요.
  • 카테고리
  • 전체 게시물
  • 내 게시물
ksw0633
2019년 9월 29일

190929

게시판: 소스 코드 제출

/*

#include <stdio.h>


#include <string.h>


#include <windows.h>


#include <math.h>


#define MAX 1000


int numstack[1000];


int stack[1000];


char charstack[1000];


char equation[1000];


int numtop=0;


int chartop=0;


int top=0;




void convert();


void calculator();




void convert()


{


int i;


for(i=0;i<strlen(equation);i++)


{


//printf("------------------------------------------\n");


if(equation[i]>=48&&equation[i]<=57)


{




int temp=0;


while(equation[i]>=48&&equation[i]<=57)


{


stack[top++]=equation[i]-'0';


i++;


}


int cnt=0;


while(top>0)


{


temp+=(stack[top-1])*pow(10.0, cnt);


top--;


}


numstack[numtop++]=temp;


}


if(equation[i]<48||equation[i]>57)


{


if(equation[i]==')'||equation[i]=='}'||equation[i]==']')


calculator();


else


charstack[chartop++]=equation[i];


}

}


calculator();


}




void calculator()//괄호 계산은 1번 , 그냥 계산은 0번


{

while(chartop>0)


{


int x, y;


int temp;


x=numstack[numtop-2];


y=numstack[numtop-1];


if(charstack[chartop-1]=='('||charstack[chartop-1]=='{'||charstack[chartop-1]=='[')

{

chartop--;

return;

}


if(charstack[chartop-1]=='+')


{


temp=x+y;


numtop=numtop-2;


numstack[numtop++]=temp;


}


else if(charstack[chartop-1]=='-')


{


temp=x-y;


numtop=numtop-2;


numstack[numtop++]=temp;


}


else if(charstack[chartop-1]=='*')


{


temp=x*y;


numtop=numtop-2;


numstack[numtop++]=temp;


}


else if(charstack[chartop-1]=='/')


{


temp=x/y;


numtop=numtop-2;


numstack[numtop++]=temp;


}


chartop--;


}




}






int main()


{


scanf("%s", equation);


// printf("%s\n", equation);


convert();


printf("%d\n", numstack[numtop-1]);


return 0;


}

*/



#include <stdio.h>

#include <stdlib.h>

#include <windows.h>

#include <string.h>


typedef struct node

{

int index;

int data;

node *rlink;

node *llink;

}node;


node *start;

node *current;

int nodes=1;




void MAXheap(int num)

{

current->data=num;

compare();

node *newnode;

newnode=(node*)malloc(sizeof(node));

newnode->index=nodes++;

if(current->llink==NULL)

current->llink=newnode;

else

current->rlink=newnode;

current=newnode;

}


int main()

{

int num;

start = (*node)malloc(sizeof(node));

start->index=nodes++;

start->rlink=NULL;

start->llink=NULL;

current=start;

scanf("%d", &num);

}

댓글 0개
0
댓글
댓글 0개
주소 : 경기도 용인시 광교중앙로 302 블루 스퀘어 602호
연락처 : 031) 216 - 1546
사업자등록번호 : 465-92-00916
​학원 등록 제 4603호