프로그래밍 및 실습 보고서STACK의 소스 설명 및 실행200321414김동범0. STACK. LIFO(Last In First Out) 구조로 이루어짐.가. 메모리 정적 할당이 아닌 동적 할당을 사용해 메모리 사용 효율을 높이도록 코딩 됨.나. 최대 200개의 int형 숫자를 저장할수 있음.1. 각 기능 설명. PUSH : push 입력과 정수형 숫자를 입력하면 메모리에 해당 숫자가 저장된다. 해당 숫자가 저장됨과 동시에 출력이 이루어지며 먼저 입력한 숫자가 가장 아래쪽에 출력된다.가. POP : pop을 입력할 경우 가장 늦게 저장된 숫자가 메모리에서 빠져나오게 되고 나머지 숫자들이 출력된다.나. DISPLAY : 현제 메모리에 저장되있는 사용자가 입력한 숫자들을 출력한다. 만약 메모리가 비어있다면 “스택이 비어있습니다.”라는 문구가 뜨게 된다.다. END : end를 입력함과 동시에 스택의 메모리가 해제되면서 “스택을 비웁니다.”라는 문구가 출력되게 되고, 이어서 프로그램을 종료하게 된다.3. 실행 화면Figure 1 실행 화면Figure 2 실행 화면(con't)4. 소스 (주석 포함)#include#include// 문자열 비교를 위한 헤더 추가#include // 메모리 동적 할당을 위한 헤드 추가int main(void){char func[8]; // 사용자가 사용할 기능을 받을 캐릭터형 배열 선언int tos=-1; // 입력되는 값들의 순서를 위한 카운터의 선언 및 초기화int j;int num; //사용자가 입력할 정수형 숫자의 선언int *stack_memory; // 배열의 수소값 선언stack_memory = (int *)malloc(200*sizeof(int)); //배열의 메모리를 동적할당으로 사용while(1){puts("n네가지 중 원하는 기능을 입력하세요.");puts("[push] [pop] [display] [end]");printf("입력 : ");scanf("%s",func); //stack 기능을 입력 받음if(strcmp(func,"push")==0) // 사용자가 "push"를 입력했을때의 경우{scanf("%d",&num); // 사용자가 입력한 정수를 입력 받음++tos; // 배열의 첫번째 공간에 입력해야하므로 처음 시작시 tos를 0으로 변경stack_memory[tos]=num; //사용자 입력값을 메모리에 저장j=tos;do{ //do-while문으로 출력printf("%dn",stack_memory[j]); //메모리에 저장된 숫자 출력j--;}while(j!=-1);continue; //상위 while(1)문을 다시 실행 시킴}if(strcmp(func,"pop")==0) // 사용자가 "pop"를 입력했을때의 경우{--tos; //사용자가 "pop"을 입력할 경우 카운터값 감소for(j=tos;j!=-1;j--) //for문으로 출력printf("%dn",stack_memory[j]);if(tos
IntroductionThe ITS (Intelligent Transportation System) isthe Informatization project which operatetransportation facilities efficiently and offertraffic information to people to pass safelyand conveniently.It is also the integrated system betweenInformation and Communication network -software technology of communication,electronics, control and computing - andTransport network – infrastructure such asroad and vehicle.One of the reason that we should establishthe ITS is the traffic congestion. Vehicles havebeen getting increasing in proportion as theindustry flourish for a long time. But the landis not unlimited. Therefore the congestion hasbeen occurred. It has caused not only trafficproblem but also travel time, air pollution andfuel consumption. The problem is that thosemust be connected with financial damage tothe nation and people. Thus, the ITS should beestablished as quickly as possible.Another is that the life zone in big citiesbecame wide.