목차
1. 설정
2. 설계
3. 소스
4. 결과화면
2. 설계
3. 소스
4. 결과화면
본문내용
root=NULL;
while(inp2(in) ==NO)
root=node(root, in);
printf("\nInput : \n");
printf("----------------------\n\n");
prn(root);
root=invert(root);
printf("\ninverse : \n");
prn(root);
printf("\n\n");
}
LIST *node(LIST *rp, char *nin)
{
if(rp==NULL)
{
char *temp=NULL;
temp = (char*)malloc(strlen(nin)+1);
strcpy(temp,nin);
rp=(LIST *)malloc(sizeof(LIST));
rp->name=temp;
rp->nextp=NULL;
}
else
rp->nextp=node(rp->nextp, nin);
return(rp);
}
int inp2(char *iin)
{
printf("\nInput (EXIT = 'x'): ");
scanf("%s", iin);
if(*iin == 'x')
return (YES);
return (NO);
}
LIST *invert(LIST *lead)
{
LIST *trail, *midle;
midle=NULL;
while(lead != NULL)
{
trail=midle;
midle = lead;
lead = lead->nextp;
midle->nextp=trail;
}
return midle;
}
void prn(LIST *ps)
{
for( ; ps; ps=ps->nextp)
printf(" %s ", ps->name);
}
while(inp2(in) ==NO)
root=node(root, in);
printf("\nInput : \n");
printf("----------------------\n\n");
prn(root);
root=invert(root);
printf("\ninverse : \n");
prn(root);
printf("\n\n");
}
LIST *node(LIST *rp, char *nin)
{
if(rp==NULL)
{
char *temp=NULL;
temp = (char*)malloc(strlen(nin)+1);
strcpy(temp,nin);
rp=(LIST *)malloc(sizeof(LIST));
rp->name=temp;
rp->nextp=NULL;
}
else
rp->nextp=node(rp->nextp, nin);
return(rp);
}
int inp2(char *iin)
{
printf("\nInput (EXIT = 'x'): ");
scanf("%s", iin);
if(*iin == 'x')
return (YES);
return (NO);
}
LIST *invert(LIST *lead)
{
LIST *trail, *midle;
midle=NULL;
while(lead != NULL)
{
trail=midle;
midle = lead;
lead = lead->nextp;
midle->nextp=trail;
}
return midle;
}
void prn(LIST *ps)
{
for( ; ps; ps=ps->nextp)
printf(" %s ", ps->name);
}
추천자료
자바프로그램 다운로딩
자바로 최대공약수, 최소공배수 구하기
자바로 삼각형, 역삼각형, 마름모 (다이아몬드) 출력하기
자바로 재귀 함수를 사용하여 하노이탑 구현하기
자바로 행렬 곱 구하기
자바로 구현한 네트워크 오목(넷마블 오목 형식)
자바로 배우는 프로그래밍 기초 4장
자바로 배우는 프로그래밍 기초 11장
자바로 배우는 프로그래밍 7장
자바 swing 으로 구현한 윈도우 메모장
자바 프로젝트 은행 프로그램 term project
자바 프로젝트 ATM 은행 프로그램 term project
자바를 이용한 Up&Down게임 프로그래밍 소스입니다.
자바 네트워크 프로그래밍
소개글