<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CC0E7B0EDB0FCB8AE5C53746F636B5F4D616E D656E74732E637070>

Size: px
Start display at page:

Download "<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CC0E7B0EDB0FCB8AE5C53746F636B5F4D616E D656E74732E637070>"

Transcription

1 1 #include <fstream> 2 #include <iomanip> 3 #include <conio.h> 4 #include <Windows.h> 5 #include <ctime> 6 #include "QuickSort.h" 7 using namespace std; Node* Queue[100]; // 추가입력된데이터를저장하기위한 Queue 11 int QueueTop, QueueTail; char password[5]={"1234"}; // 기본비밀번호 struct tm A; // 현재날짜를구하기위한변수 16 time_t t; 17 char today[10]; void InitInput(){ 20 ifstream in("input.txt"); // input.txt에서처음데이터를읽어온다. 21 head->next = head->prev = NULL; 22 tail->next = tail->prev = NULL; 23 while(!in.eof()){ 24 Node* newnode = new Node; 25 in >> newnode->id >> newnode->name >> newnode->stock; 26 in >> newnode->indate >> newnode->outdate >> newnode->period; 27 in >> newnode->discusedate >> newnode->manager; // 폐기현황 30 if(strcmp(newnode->discusedate,today) <= 0) newnode->condition[0]='o'; 31 else newnode->condition[0]='x'; // 입고현황 34 if(strcmp(newnode->indate,today) <= 0) newnode->condition[1]='o'; 35 else newnode->condition[1]='x'; // 출고현황 38 if(strcmp(newnode->outdate,today) <= 0) newnode->condition[2]='o'; 39 else newnode->condition[2]='x'; newnode->condition[3] = NULL; 42 InsertNode(newnode); 43 } 44 } 45 void KeyInput(){ // 키보드로추가입력 46 Node* newnode = new Node; 47 cout << "ID를입력하세요 :";cin >> newnode->id; 48 cout << " 물품명 : " ; cin >> newnode->name; 49 cout << " 물품수량 : "; cin >> newnode->stock; cout << " 입고일 : "; cin >> newnode->indate; 52 cout << " 출고일 : "; cin >> newnode->outdate; 53 cout << " 보관기간 : "; cin >> newnode->period; cout << " 폐기일 : "; cin >> newnode->discusedate; 56 cout << " 관리자 : "; cin >> newnode->manager; // 폐기현황 59 if(strcmp(newnode->discusedate,today) <= 0) newnode->condition[0]='o'; 60 else newnode->condition[0]='x'; // 입고현황 63 if(strcmp(newnode->indate,today) <= 0) newnode->condition[1]='o'; 64 else newnode->condition[1]='x'; 1

2 65 66 // 출고현황 67 if(strcmp(newnode->outdate,today) <= 0) newnode->condition[2]='o'; 68 else newnode->condition[2]='x'; Queue[QueueTail++] = newnode; // 추가입려된노드는 queue에저장 71 InsertNode(newnode); 72 } 73 void FileInput(){ // 파일로추가입력 74 char FileName[10]; 75 cout << " 입력받을파일의이름 : "; 76 cin >> FileName; // 확장자까지입력해야됨 77 ifstream in(filename); 78 while(!in.eof()){ 79 Node* newnode = new Node; 80 in >> newnode->id >> newnode->name >> newnode->stock; 81 in >> newnode->indate >> newnode->outdate >> newnode->period; 82 in >> newnode->discusedate >> newnode->manager; // 폐기현황 85 if(strcmp(newnode->discusedate,today) <= 0) newnode->condition[0]='o'; 86 else newnode->condition[0]='x'; // 입고현황 89 if(strcmp(newnode->indate,today) <= 0) newnode->condition[1]='o'; 90 else newnode->condition[1]='x'; // 출고현황 93 if(strcmp(newnode->outdate,today) <= 0) newnode->condition[2]='o'; 94 else newnode->condition[2]='x'; Queue[QueueTail++] = newnode; // 추가입력된데이터는큐에저장 97 InsertNode(newnode); 98 } 99 } 100 void Output(){ // 출력 101 Node* current = head->next; 102 cout << setw(10) << "ID" << setw(12) << " 물품명 " << setw(12) << " 재고현황 " << setw(12) << " 폐 기현황 " << setw(12) << " 입고현황 " << setw(12) << " 출고현황 " << endl; 103 cout << " ===========================================================================" << endl; 104 while(current!=tail){ 105 cout << setw(10) << current->id << setw(12) << current->name << setw(12) << current-> stock << setw(12) << current->condition[0] << setw(12) << current->condition[1] << setw(12) < < current->condition[2] << endl; 106 current = current->next; 107 } 108 } 109 void FileOutput(){ // 파일출력 110 char FileName[10]; 111 cout << " 출력할파일이름 : "; 112 cin >> FileName; 113 ofstream out(filename); Node* current = head->next; 116 out << setw(10) << "ID" << setw(12) << " 물품명 " << setw(12) << " 재고현황 " << setw(12) << " 폐 기현황 " << setw(12) << " 입고현황 " << setw(12) << " 출고현황 " << endl; 117 out << " ===========================================================================" << endl ; 118 while(current!=tail){ 119 out << setw(10) << current->id << setw(12) << current->name << setw(12) << current->stock << setw(12) << current->condition[0] << setw(12) << current->condition[1] << setw(12) << current->condition[2] << endl; 120 current = current->next; 2

3 121 } 122 } 123 void Delete(){ 124 char id[10]; 125 cout << " 삭제하실물품 id : "; 126 cin >> id; DeleteNode(id); 129 } 130 void InputMenu(){ 131 cout << " IntputMenu " << endl; 132 cout << " 1. 기본입력 " << endl; 133 cout << " 2. 추가입력 ( 키보드 )" << endl; 134 cout << " 3. 추가입력 ( 파일 )" << endl; 135 cout << " 4. 물품삭제 " << endl; 136 cout << " 0. 뒤로 " << endl; 137 cout << " " << endl; 138 cout << " 입력? "; 139 int choice; 140 cin >> choice; 141 switch(choice){ 142 case 1: 143 InitInput(); 144 break; 145 case 2: 146 KeyInput(); 147 break; 148 case 3: 149 FileInput(); 150 break; 151 case 4: 152 Delete(); 153 break; 154 case 0: 155 return; 156 default : 157 cout << " 입력오류 " << endl; 158 } 159 } 160 void OutputMenu(){ 161 cout << " OutputMenu " << endl; 162 cout << " 1. 모니터출력 " << endl; 163 cout << " 2. 파일출력 " << endl; 164 cout << " 0. 뒤로 " << endl; 165 cout << " " << endl; 166 cout << " 입력? "; 167 int choice; 168 cin >> choice; 169 switch(choice){ 170 case 1: 171 Output(); 172 break; 173 case 2: 174 FileOutput(); 175 break; 176 case 0: 177 return; 178 default : 179 cout << " 입력오류 " << endl; 180 } 181 } 182 void TotalOutput(){ 183 Node* current = head->next; 184 int cnt=0; 3

4 185 while(current!=tail){ cout << " 물품명ID : " << current->id << endl; 188 cout << " 물품명 : " << current->name << endl; 189 cout << " 수량 : " << current->stock << endl; 190 cout << " 입고일 : " << current->indate << endl; 191 cout << " 출고일 : " << current->outdate << endl; 192 cout << " 보관기간 : " << current->period << endl; 193 cout << " 폐기일 : " << current->discusedate << endl; 194 cout << " 관리자 : " << current->manager << endl; 195 cout << " " << endl; 196 current = current->next; 197 cnt++; 198 if(cnt%5==0) { 199 cout << " 아무키나입력해주세요."; 200 char temp = getch(); 201 cout << endl; 202 } 203 } 204 } 205 void ManageStock(){ // 재고관리하는함수 206 char InputId[10]; 207 cout << " 수정할물품명ID : "; 208 cin >> InputId; 209 Node* current = head->next; 210 while(current!=tail){ 211 if(strcmp(current->id, InputId) == 0){ 212 cout << " 수정할재고를입력해주세요 : "; 213 cin >> current->stock; 214 break; 215 } 216 current = current->next; 217 } 218 if(current == tail){ // 찾는 ID가없는경우에러메세지출력 219 cout << " 찾는물품명ID가없습니다." << endl; 220 } 221 } 222 void Manager(){ // 관리자함수 223 char input_pass[5]={0}; 224 cout << " Manager " << endl; 225 cout << " 비밀번호 : "; 226 for(int i=0;i<4;i++){ 227 input_pass[i]=getch(); 228 cout << "*"; 229 } 230 cout << endl; 231 if(strcmp(password,input_pass)!=0){ 232 cout << " 비밀번호가틀렸습니다." << endl; 233 return; 234 } 235 system("cls"); 236 cout << " Manager " << endl; 237 cout << " 1. 전체결과보기 " << endl; 238 cout << " 2. 물품재고관리 " << endl; 239 cout << " 3. 비밀번호변경하기 " << endl; 240 cout << " 0. 뒤로 " << endl; 241 cout << " " << endl; 242 cout << " 입력? " ; 243 int choice; 244 cin >> choice; 245 switch(choice){ 246 case 1: 247 TotalOutput(); 248 break; 4

5 249 case 2: 250 ManageStock(); 251 break; 252 case 3: 253 cout << " 바꾸실비밀번호 4자리를입력해주세요 : "; 254 cin >> password; 255 break; 256 default : 257 cout << " 입력오류 " << endl; 258 } 259 } 260 void Menu(){ // 기본메뉴 261 for(;;){ 262 cout << " Menu " << endl; 263 cout << " 1. 입력 " << endl; 264 cout << " 2. 출력 " << endl; 265 cout << " 3. 정렬 " << endl; 266 cout << " 4. 관리자 " << endl; 267 cout << " 0. 종료 " << endl; 268 cout << " " << endl; 269 cout << " 입력? " ; 270 int choice; 271 cin >> choice; 272 switch(choice){ 273 case 1: 274 InputMenu(); 275 break; 276 case 2: 277 OutputMenu(); 278 break; 279 case 3: 280 cout << " 1. ID 오름차순정렬 " << endl; 281 cout << " 2. ID 내림차순정렬 " << endl; 282 cout << " 3. 물품명오름차순정렬 " << endl; 283 cout << " 4. 물품명내림차순정렬 " << endl; 284 cout << " 5. 입고일오름차순정렬 " << endl; 285 cout << " 6. 입고일내림차순정렬 " << endl; 286 cout << " 입력?"; 287 cin >> choice; 288 if(choice>=1 && choice<=6) 289 QuickSort(choice,head->next,tail->prev); 290 else { 291 cout << " 입력오류 " << endl; 292 } 293 break; 294 case 4: 295 Manager(); 296 break; 297 case 0: 298 return; 299 default : 300 cout << " 입력오류 " << endl; 301 } 302 } 303 } 304 void main(){ 305 // 현재날짜구하기 306 time(&t); 307 localtime_s(&a,&t); 308 int year,month,day; 309 char temp[10]; 310 year = A.tm_year+1900; 311 month = A.tm_mon+1; 312 day = A.tm_mday; 5

6 313 itoa(year,temp,10); 314 strcat(today,temp); strcat(today,"."); if(month<10){ 319 strcat(today,"0"); 320 } 321 itoa(month,temp,10); 322 strcat(today,temp); strcat(today,"."); if(day<10){ 327 strcat(today,"0"); 328 } 329 itoa(day,temp,10); 330 strcat(today,temp); Menu(); 334 } 335 6

C프로-3장c03逞풚

C프로-3장c03逞풚 C h a p t e r 03 C++ 3 1 9 4 3 break continue 2 110 if if else if else switch 1 if if if 3 1 1 if 2 2 3 if if 1 2 111 01 #include 02 using namespace std; 03 void main( ) 04 { 05 int x; 06 07

More information

Microsoft PowerPoint - [2009] 02.pptx

Microsoft PowerPoint - [2009] 02.pptx 원시데이터유형과연산 원시데이터유형과연산 원시데이터유형과연산 숫자데이터유형 - 숫자데이터유형 원시데이터유형과연산 표준입출력함수 - printf 문 가장기본적인출력함수. (stdio.h) 문법 ) printf( Test printf. a = %d \n, a); printf( %d, %f, %c \n, a, b, c); #include #include

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 13 장파일처리 1. 스트림의개념을이해한다. 2. 객체지향적인방법을사용하여파일입출력을할수있다. 3. 텍스트파일과이진파일의차이점을이해한다. 4. 순차파일과임의접근파일의차이점을이해한다. 이번장에서만들어볼프로그램 스트림 (stream) 스트림 (stream) 은 순서가있는데이터의연속적인흐름 이다. 스트림은입출력을물의흐름처럼간주하는것이다. 입출력관련클래스들 파일쓰기

More information

The C++ Programming Language 5 장포인터, 배열, 구조체 5.9 연습문제 다음의선언문을순서대로작성해보자. 문자에대한포인터, 10개정수의배열, 10개정수의배열의참조자, 문자열의배열에대한포인터, 문자에대한포인터에대한포인터, 상수정수, 상수

The C++ Programming Language 5 장포인터, 배열, 구조체 5.9 연습문제 다음의선언문을순서대로작성해보자. 문자에대한포인터, 10개정수의배열, 10개정수의배열의참조자, 문자열의배열에대한포인터, 문자에대한포인터에대한포인터, 상수정수, 상수 The C++ Programming Language 5 장포인터, 배열, 구조체 5.9 연습문제 5.9.1 다음의선언문을순서대로작성해보자. 문자에대한포인터, 10개정수의배열, 10개정수의배열의참조자, 문자열의배열에대한포인터, 문자에대한포인터에대한포인터, 상수정수, 상수정수에대한포인터, 정수에대한상수포인터. 그리고각각의객체를초기화하자. Ex 문자에대한포인터 char

More information

A Hierarchical Approach to Interactive Motion Editing for Human-like Figures

A Hierarchical Approach to Interactive Motion Editing for Human-like Figures 단일연결리스트 (Singly Linked List) 신찬수 연결리스트 (linked list)? tail 서울부산수원용인 null item next 구조체복습 struct name_card { char name[20]; int date; } struct name_card a; // 구조체변수 a 선언 a.name 또는 a.date // 구조체 a의멤버접근 struct

More information

Microsoft PowerPoint - ch10 - 이진트리, AVL 트리, 트리 응용 pm0600

Microsoft PowerPoint - ch10 - 이진트리, AVL 트리, 트리 응용 pm0600 균형이진탐색트리 -VL Tree delson, Velskii, Landis에의해 1962년에제안됨 VL trees are balanced n VL Tree is a binary search tree such that for every internal node v of T, the heights of the children of v can differ by at

More information

(Microsoft PowerPoint - 11\300\345.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - 11\300\345.ppt [\310\243\310\257 \270\360\265\345]) 입출력 C++ 의효율적인입출력방법을배워보자. 이장에서다룰내용 1 cin 과 cout 을이용한입출력 2 입출력연산자중복 3 조작자생성 4 파일입출력 01_cin 과 cout 을이용한입출력 포맷입출력 C++ 의표준입출력은 cin, cout 을사용한다. C 의 printf 는함수이므로매번여러인자를입력해줘야하지만, cin/cout 에서는형식을한번만정의하면계속사용할수있다.

More information

untitled

untitled if( ) ; if( sales > 2000 ) bonus = 200; if( score >= 60 ) printf(".\n"); if( height >= 130 && age >= 10 ) printf(".\n"); if ( temperature < 0 ) printf(".\n"); // printf(" %.\n \n", temperature); // if(

More information

설계란 무엇인가?

설계란 무엇인가? 금오공과대학교 C++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 4 강. 함수와라이브러리함수목차 함수오버로딩 디폴트매개변수 라이브러리함수 clock 함수 난수발생 비버퍼형문자입력 커서이동 프로그래밍문제 1 /21 4 강. 함수와라이브러리함수함수오버로딩 2 /21 함수오버로딩 동일한이름의함수를여러개만들수있음 함수프로파일이달라야함 함수프로파일

More information

03_queue

03_queue Queue Data Structures and Algorithms 목차 큐의이해와 ADT 정의 큐의배열기반구현 큐의연결리스트기반구현 큐의활용 덱 (Deque) 의이해와구현 Data Structures and Algorithms 2 큐의이해와 ADT 정의 Data Structures and Algorithms 3 큐 (Stack) 의이해와 ADT 정의 큐는 LIFO(Last-in,

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

설계란 무엇인가?

설계란 무엇인가? 금오공과대학교 C++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 15 강. 표준입출력목차 C++ 입출력클래스 입출력형식설정방법 setf, unsetf 멤버함수에의한입출력형식설정 setf 이외의멤버함에의한입출력형식설정 입출력조작자에의한입출력형식설정 문자및문자열입출력멤버함수 문자단위입출력 줄단위입력 입출력스트림상태 string 클래스 complex

More information

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100 2015-1 프로그래밍언어 9. 연결형리스트, Stack, Queue 2015 년 5 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) 연결리스트 (Linked List) 연결리스트연산 Stack

More information

C++ Programming

C++ Programming C++ Programming 예외처리 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 예외처리 2 예외처리 예외처리 C++ 의예외처리 예외클래스와객체 3 예외처리 예외를처리하지않는프로그램 int main() int a, b; cout > a >> b; cout

More information

2002년 2학기 자료구조

2002년 2학기 자료구조 자료구조 (Data Structures) Chapter 1 Basic Concepts Overview : Data (1) Data vs Information (2) Data Linear list( 선형리스트 ) - Sequential list : - Linked list : Nonlinear list( 비선형리스트 ) - Tree : - Graph : (3)

More information

03장.스택.key

03장.스택.key ---------------- DATA STRUCTURES USING C ---------------- 03CHAPTER 1 ? (stack): (LIFO:Last-In First-Out) 2 : top : ( index -1 ),,, 3 : ( ) ( ) -> ->. ->.... 4 Stack ADT : (LIFO) : init():. is_empty():

More information

설계란 무엇인가?

설계란 무엇인가? 금오공과대학교 C++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 16 강. 파일입출력목차 파일입출력기초 파일입출력모드 텍스트파일과이진파일 이진파일입출력 임의접근 1 /18 16 강. 파일입출력파일입출력기초 파일입출력과정 파일스트림객체생성 파일열기 사용 : 기본적으로표준입출력객체 (cin, cout) 사용방법과동일 파일닫기 파일스트림클래스의종류

More information

Microsoft PowerPoint - chap11-포인터의활용.pptx

Microsoft PowerPoint - chap11-포인터의활용.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 포인터를 사용하는 다양한 방법에

More information

06장.리스트

06장.리스트 ---------------- DATA STRUCTURES USING C ---------------- CHAPTER 리스트 1/28 리스트란? 리스트 (list), 선형리스트 (linear list) 순서를가진항목들의모임 집합 : 항목간의순서의개념이없음 리스트의예 요일 : ( 일요일, 월요일,, 토요일 ) 한글자음의모임 : ( ㄱ, ㄴ,, ㅎ ) 카드 :

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 5 장생성자와접근제어 1. 객체지향기법을이해한다. 2. 클래스를작성할수있다. 3. 클래스에서객체를생성할수있다. 4. 생성자를이용하여객체를초기화할수 있다. 5. 접근자와설정자를사용할수있다. 이번장에서만들어볼프로그램 생성자 생성자 (constructor) 는초기화를담당하는함수 생성자가필요한이유 #include using namespace

More information

5.스택(강의자료).key

5.스택(강의자료).key CHP 5: https://www.youtube.com/watch?v=ns-r91557ds ? (stack): (LIFO:Last-In First-Out):. D C B C B C B C B (element) C (top) B (bottom) (DT) : n element : create() ::=. is_empty(s) ::=. is_full(s) ::=.

More information

Microsoft PowerPoint - Chapter 1-rev

Microsoft PowerPoint - Chapter 1-rev 1.C 기반의 C++ part 1 스트림입출력 함수 오버로딩 (overloading) 디폴트매개변수 (default parameter) 인-라인함수 (in-line function) 이름공간 (namespace) Jong Hyuk Park 스트림입출력 Jong Hyuk Park printf 와 scanf 출력의기본형태 : 과거스타일! iostream.h 헤더파일의포함

More information

Lab 3. 실습문제 (Single linked list)_해답.hwp

Lab 3. 실습문제 (Single linked list)_해답.hwp Lab 3. Singly-linked list 의구현 실험실습일시 : 2009. 3. 30. 담당교수 : 정진우 담당조교 : 곽문상 보고서제출기한 : 2009. 4. 5. 학과 : 학번 : 성명 : 실습과제목적 : 이론시간에배운 Singly-linked list를실제로구현할수있다. 실습과제내용 : 주어진소스를이용해 Singly-linked list의각함수를구현한다.

More information

쉽게 풀어쓴 C 프로그래밍

쉽게 풀어쓴 C 프로그래밍 제 3 장함수와문자열 1. 함수의기본적인개념을이해한다. 2. 인수와매개변수의개념을이해한다. 3. 함수의인수전달방법 2가지를이해한다 4. 중복함수를이해한다. 5. 디폴트매개변수를이해한다. 6. 문자열의구성을이해한다. 7. string 클래스의사용법을익힌다. 이번장에서만들어볼프로그램 함수란? 함수선언 함수호출 예제 #include using

More information

chap01_time_complexity.key

chap01_time_complexity.key 1 : (resource),,, 2 (time complexity),,, (worst-case analysis) (average-case analysis) 3 (Asymptotic) n growth rate Θ-, Ο- ( ) 4 : n data, n/2. int sample( int data[], int n ) { int k = n/2 ; return data[k]

More information

Lab 4. 실습문제 (Circular singly linked list)_해답.hwp

Lab 4. 실습문제 (Circular singly linked list)_해답.hwp Lab 4. Circular singly-linked list 의구현 실험실습일시 : 2009. 4. 6. 담당교수 : 정진우 담당조교 : 곽문상 보고서제출기한 : 2009. 4. 12. 학과 : 학번 : 성명 : 실습과제목적 : 이론시간에배운 Circular Singly-linked list를실제로구현할수있다. 실습과제내용 : 주어진소스를이용해 Circular

More information

61 62 63 64 234 235 p r i n t f ( % 5 d :, i+1); g e t s ( s t u d e n t _ n a m e [ i ] ) ; if (student_name[i][0] == \ 0 ) i = MAX; p r i n t f (\ n :\ n ); 6 1 for (i = 0; student_name[i][0]!= \ 0&&

More information

Chapter 4. LISTS

Chapter 4. LISTS 6. 동치관계 (Equivalence Relations) 동치관계 reflexive, symmetric, transitive 성질을만족 "equal to"(=) 관계는동치관계임. x = x x = y 이면 y = x x = y 이고 y = z 이면 x = z 동치관계를이용하여집합 S 를 동치클래스 로분할 동일한클래스내의원소 x, y 에대해서는 x y 관계성립

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C D616E2E637070> #include "stdafx.h" #include "Huffman.h" 1 /* 비트의부분을뽑아내는함수 */ unsigned HF::bits(unsigned x, int k, int j) return (x >> k) & ~(~0

More information

슬라이드 1

슬라이드 1 CHAP 6: 큐 yicho@gachon.ac.kr 1 큐 (QUEUE) 큐 : 먼저들어온데이터가먼저나가는자료구조 선입선출 (FIFO: First-In First-Out) ( 예 ) 매표소의대기열 Ticket Box 전단 () 후단 () 2 큐 ADT 삽입과삭제는 FIFO 순서를따른다. 삽입은큐의후단에서, 삭제는전단에서이루어진다. 객체 : n 개의 element

More information

C++ Programming

C++ Programming C++ Programming 연산자다중정의 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 연산자다중정의 C++ 스타일의문자열 2 연산자다중정의 연산자다중정의 단항연산자다중정의 이항연산자다중정의 cin, cout 그리고 endl C++ 스타일의문자열 3 연산자다중정의 연산자다중정의 (Operator

More information

chap 5: Trees

chap 5: Trees 5. Threaded Binary Tree 기본개념 n 개의노드를갖는이진트리에는 2n 개의링크가존재 2n 개의링크중에 n + 1 개의링크값은 null Null 링크를다른노드에대한포인터로대체 Threads Thread 의이용 ptr left_child = NULL 일경우, ptr left_child 를 ptr 의 inorder predecessor 를가리키도록변경

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 C 언어포인터정복하기 16 강. 포인터로자료구조화하기 TAE-HYONG KIM COMPUTER ENG, KIT 2 학습내용 구조체멤버와구조체포인터멤버 다른구조체 ( 변수 ) 를가리키는구조체 ( 변수 ) 연결된리스트 의구성및관리 포인터로 연결된리스트 탐색하기 3 중첩구조체에자료저장하기 중첩된구조체변수에값저장하기 struct person { char PRID[15];

More information

PowerPoint Template

PowerPoint Template 1.C 기반의 C++ 스트림입출력 함수 오버로딩 (overloading) 디폴트매개변수 (default parameter) 인-라인함수 (in-line function) 이름공간 (namespace) Jong Hyuk Park 스트림입출력 Jong Hyuk Park printf 와 scanf 출력의기본형태 iostream 헤더파일의포함 HelloWorld2.cpp

More information

Microsoft PowerPoint - Chapter_09.pptx

Microsoft PowerPoint - Chapter_09.pptx 프로그래밍 1 1 Chapter 9. Structures May, 2016 Dept. of software Dankook University http://embedded.dankook.ac.kr/~baeksj 구조체의개념 (1/4) 2 (0,0) 구조체 : 다양한종류의데이터로구성된사용자정의데이터타입 복잡한자료를다루는것을편하게해줌 예 #1: 정수로이루어진 x,

More information

C++ Programming

C++ Programming C++ Programming C++ 스타일의입출력 Seo, Doo-okok clickseo@gmail.com http://www.clickseo.com 목 차 C 스타일의입출력 C++ 스타일의입출력 2 C 스타일의입출력 #include C 스타일의입출력 int main() { int a, b, c; printf(" 세개의정수입력 : "); scanf("%d

More information

Chapter 4. LISTS

Chapter 4. LISTS C 언어에서리스트구현 리스트의생성 struct node { int data; struct node *link; ; struct node *ptr = NULL; ptr = (struct node *) malloc(sizeof(struct node)); Self-referential structure NULL: defined in stdio.h(k&r C) or

More information

Microsoft PowerPoint - C++ 5 .pptx

Microsoft PowerPoint - C++ 5 .pptx C++ 언어프로그래밍 한밭대학교전자. 제어공학과이승호교수 연산자중복 (operator overloading) 이란? 2 1. 연산자중복이란? 1) 기존에미리정의되어있는연산자 (+, -, /, * 등 ) 들을프로그래머의의도에맞도록새롭게정의하여사용할수있도록지원하는기능 2) 연산자를특정한기능을수행하도록재정의하여사용하면여러가지이점을가질수있음 3) 하나의기능이프로그래머의의도에따라바뀌어동작하는다형성

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 실습 1 배효철 th1g@nate.com 1 목차 조건문 반복문 System.out 구구단 모양만들기 Up & Down 2 조건문 조건문의종류 If, switch If 문 조건식결과따라중괄호 { 블록을실행할지여부결정할때사용 조건식 true 또는 false값을산출할수있는연산식 boolean 변수 조건식이 true이면블록실행하고 false 이면블록실행하지않음 3

More information

슬라이드 1

슬라이드 1 정적메모리할당 (Static memory allocation) 일반적으로프로그램의실행에필요한메모리 ( 변수, 배열, 객체등 ) 는컴파일과정에서결정되고, 실행파일이메모리에로드될때할당되며, 종료후에반환됨 동적메모리할당 (Dynamic memory allocation) 프로그램의실행중에필요한메모리를할당받아사용하고, 사용이끝나면반환함 - 메모리를프로그램이직접관리해야함

More information

UI TASK & KEY EVENT

UI TASK & KEY EVENT KEY EVENT & STATE 구현 2007. 1. 25 PLATFORM TEAM 정용학 차례 Key Event HS TASK UI TASK LONG KEY STATE 구현 소스코드및실행화면 질의응답및토의 2 KEY EVENT - HS TASK hs_task keypad_scan_keypad hs_init keypad_pass_key_code keypad_init

More information

설계란 무엇인가?

설계란 무엇인가? 금오공과대학교 C++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 5 강. 배열, 포인터, 참조목차 배열 포인터 C++ 메모리구조 주소연산자 포인터 포인터연산 배열과포인터 메모리동적할당 문자열 참조 1 /20 5 강. 배열, 포인터, 참조배열 배열 같은타입의변수여러개를하나의변수명으로처리 int Ary[10]; 총 10 개의변수 : Ary[0]~Ary[9]

More information

Microsoft PowerPoint - 자료구조2008Chap06

Microsoft PowerPoint - 자료구조2008Chap06 제 6 장연결리스트 연결리스트개요 2 일정한순서를가지는데이터요소들을표현하는방법중의하나이다. 배열과다르게데이터요소들의논리적인순서만유지되고기억장소내에서는각데이터요소들은논리적인순서와는상관없는임의의위치를가지도록하는자료구조이다. 연결리스트에서는각데이터요소들이기억장소내의어떤위치에어떤항목이있는지를표시해주어야한다. 이를위해데이터요소에는데이터값 (value) 뿐만아니라위치정보

More information

(Microsoft PowerPoint - 07\300\345.ppt [\310\243\310\257 \270\360\265\345])

(Microsoft PowerPoint - 07\300\345.ppt [\310\243\310\257 \270\360\265\345]) 클래스의응용 클래스를자유자재로사용하자. 이장에서다룰내용 1 객체의치환 2 함수와클래스의상관관계 01_ 객체의치환 객체도변수와마찬가지로치환이가능하다. 기본예제 [7-1] 객체도일반변수와마찬가지로대입이가능하다. 기본예제 [7-2] 객체의치환시에는조심해야할점이있다. 복사생성자의필요성에대하여알아보자. [ 기본예제 7-1] 클래스의치환 01 #include

More information

(Microsoft Word - \301\337\260\243\260\355\273\347.docx)

(Microsoft Word - \301\337\260\243\260\355\273\347.docx) 내장형시스템공학 (NH466) 중간고사 학번 : 이름 : 문제 배점 점수 1 20 2 20 3 20 4 20 5 10 6 10 7 15 8 20 9 15 합계 150 1. (20 점 ) 다음용어에대해서설명하시오. (1) 정보은닉 (Information Hiding) (2) 캡슐화 (Encapsulation) (3) 오버로딩 (Overloading) (4) 생성자

More information

13주-14주proc.PDF

13주-14주proc.PDF 12 : Pro*C/C++ 1 2 Embeded SQL 3 PRO *C 31 C/C++ PRO *C NOT! NOT AND && AND OR OR EQUAL == = SQL,,, Embeded SQL SQL 32 Pro*C C SQL Pro*C C, C Pro*C, C C 321, C char : char[n] : n int, short, long : float

More information

12 장파일입출력 파일입출력의기초파일열기, 사용하기, 닫기파일입출력모드문자단위파일입출력텍스트파일과이진파일 read, write 함수에의한이진파일입출력임의접근입출력스트림상태입출력연산자오버로딩과파일입출력 C++ 프로그래밍입문

12 장파일입출력 파일입출력의기초파일열기, 사용하기, 닫기파일입출력모드문자단위파일입출력텍스트파일과이진파일 read, write 함수에의한이진파일입출력임의접근입출력스트림상태입출력연산자오버로딩과파일입출력 C++ 프로그래밍입문 12 장파일입출력 파일입출력의기초파일열기, 사용하기, 닫기파일입출력모드문자단위파일입출력텍스트파일과이진파일 read, write 함수에의한이진파일입출력임의접근입출력스트림상태입출력연산자오버로딩과파일입출력 C++ 프로그래밍입문 1. 파일입출력의기초 파일입출력방법 표준입출력객체인 cin, cout에해당하는파일입출력스트림객체만만들수있다면기본적인사용방법은표준입출력과동일파일입출력스트림객체의생성

More information

C 언어 프로그래밊 과제 풀이

C 언어 프로그래밊 과제 풀이 과제풀이 (1) 홀수 / 짝수판정 (1) /* 20094123 홍길동 20100324 */ /* even_or_odd.c */ /* 정수를입력받아홀수인지짝수인지판정하는프로그램 */ int number; printf(" 정수를입력하시오 => "); scanf("%d", &number); 확인 주석문 가필요한이유 printf 와 scanf 쌍

More information

리스트 (list), 선형리스트 (linear list): 순서를가진항목들의모임 집합 : 항목간의순서의개념이없음 L = n ( item0, item1,..., item -1) l 리스트의예 l 요일 : ( 일요일, 월요일,, 토요일 ) l 한글자음의모임 : ( ㄱ, ㄴ

리스트 (list), 선형리스트 (linear list): 순서를가진항목들의모임 집합 : 항목간의순서의개념이없음 L = n ( item0, item1,..., item -1) l 리스트의예 l 요일 : ( 일요일, 월요일,, 토요일 ) l 한글자음의모임 : ( ㄱ, ㄴ 00. 리스트 자료구조 01. 링크드 리스트 02. 더블 링크드 리스트 03. 환형 링크드 리스트 리스트 (list), 선형리스트 (linear list): 순서를가진항목들의모임 집합 : 항목간의순서의개념이없음 L = n ( item0, item1,..., item -1) l 리스트의예 l 요일 : ( 일요일, 월요일,, 토요일 ) l 한글자음의모임 : (

More information

Microsoft PowerPoint - Java7.pptx

Microsoft PowerPoint - Java7.pptx HPC & OT Lab. 1 HPC & OT Lab. 2 실습 7 주차 Jin-Ho, Jang M.S. Hanyang Univ. HPC&OT Lab. jinhoyo@nate.com HPC & OT Lab. 3 Component Structure 객체 (object) 생성개념을이해한다. 외부클래스에대한접근방법을이해한다. 접근제어자 (public & private)

More information

1장. 리스트

1장. 리스트 01. 링크드리스트 02. 더블링크드리스트 03. 환형링크드리스트 배열과는달리유연하게크기를바꿀수있는자료구조 각노드는다음노드를가리키는포인터를가짐. 각노드를다음노드를가리키는포인터로연결하여만든리스트. Single Linked List 라고도함. 링크드리스트의첫번째노드를헤드 (Head), 마지막노드를테일 (Tail) 이라고한다. C 언어로표현하는링크드리스트의노드 typedef

More information

Chapter 4. LISTS

Chapter 4. LISTS 연결리스트의응용 류관희 충북대학교 1 체인연산 체인을역순으로만드는 (inverting) 연산 3 개의포인터를적절히이용하여제자리 (in place) 에서문제를해결 typedef struct listnode *listpointer; typedef struct listnode { char data; listpointer link; ; 2 체인연산 체인을역순으로만드는

More information

Lab 5. 실습문제 (Double linked list)-1_해답.hwp

Lab 5. 실습문제 (Double linked list)-1_해답.hwp Lab 5. Doubly-linked list 의구현 실험실습일시 : 2009. 4. 13. 담당교수 : 정진우 담당조교 : 곽문상 보고서제출기한 : 2009. 4. 19. 학과 : 학번 : 성명 : 실습과제목적 : 이론시간에배운 Doubly-linked list를실제로구현할수있다. 실습과제내용 : 주어진소스를이용해 Doubly-linked list의각함수를구현한다.

More information

슬라이드 1

슬라이드 1 CHP 6: 큐 C 로쉽게풀어쓴자료구조 생능출판사 2005 큐 (QUEUE) 큐 : 먼저들어온데이터가먼저나가는자료구조 선입선출 (FIFO: First-In First-Out) ( 예 ) 매표소의대기열 Ticket Box 전단 () 후단 () 큐 DT 삽입과삭제는 FIFO 순서를따른다. 삽입은큐의후단에서, 삭제는전단에서이루어진다. 객체 : n 개의 element

More information

Programming hwp

Programming hwp struct MerchandiseTable { CatalogEntry tab[10]; void init(); char const *getname(char const *code); int getprice(char const *code); void MerchandiseTable::init() { strcpy(tab[0].code, "m01"); strcpy(tab[0].name,

More information

chap8.PDF

chap8.PDF 8 Hello!! C 2 3 4 struct - {...... }; struct jum{ int x_axis; int y_axis; }; struct - {...... } - ; struct jum{ int x_axis; int y_axis; }point1, *point2; 5 struct {....... } - ; struct{ int x_axis; int

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 3 if, if else, if else if, switch case for, while, do while break, continue : System.in, args, JOptionPane for (,, ) @ vs. logic data method variable Data Data Flow (Type), ( ) @ Member field

More information

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx

Microsoft PowerPoint - chap02-C프로그램시작하기.pptx #include int main(void) { int num; printf( Please enter an integer "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 을 작성하면서 C 프로그램의

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - (Asynchronous Mode) - - - ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - UART (Univ ers al As y nchronous Receiver / T rans mitter) 8250A 8250A { COM1(3F8H). - Line Control Register

More information

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

Microsoft PowerPoint - chap13-입출력라이브러리.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 스트림의 기본 개념을 알아보고,

More information

080629_CFP °ø°³¿ë.hwp

080629_CFP °ø°³¿ë.hwp int deleteq(int *front, rear) int item; if ( ( 가 ) ) retuen queue_empty; ( ( 나 ) ) ; return queue[*front]; 주어진문제의해에접근한결과, 즉근사해를출력하거나혹은일정확률이상의정확한해를구할수있는알고리즘으로, 이알고리즘은주어진문제에대한근사해로만족할수있거나, 간혹틀린해를출력하는경우를허용할수있는경우활용할수있다.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 @ Lesson 2... ( ). ( ). @ vs. logic data method variable behavior attribute method field Flow (Type), ( ) member @ () : C program Method A ( ) Method B ( ) Method C () program : Java, C++, C# data @ Program

More information

The C++ Programming Language 4 장타입과선언 4.11 연습문제 Hello,world! 프로그램을실행시킨다. 프로그램이컴파일되지않으면 B3.1 을참고하자. #include<iostream> //#include 문, 헤더파일, 전처리지시

The C++ Programming Language 4 장타입과선언 4.11 연습문제 Hello,world! 프로그램을실행시킨다. 프로그램이컴파일되지않으면 B3.1 을참고하자. #include<iostream> //#include 문, 헤더파일, 전처리지시 The C++ Programming Language 4 장타입과선언 4.11 연습문제 4.11.1 Hello,world! 프로그램을실행시킨다. 프로그램이컴파일되지않으면 B3.1 을참고하자. #include //#include 문, 헤더파일, 전처리지시자로호칭 using namespace std; //using 키워드를사용하여 std 네임스페이스를사용선언

More information

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt

Microsoft PowerPoint - 3ÀÏ°_º¯¼ö¿Í »ó¼ö.ppt 변수와상수 1 변수란무엇인가? 변수 : 정보 (data) 를저장하는컴퓨터내의특정위치 ( 임시저장공간 ) 메모리, register 메모리주소 101 번지 102 번지 변수의크기에따라 주로 byte 단위 메모리 2 기본적인변수형및변수의크기 변수의크기 해당컴퓨터에서는항상일정 컴퓨터마다다를수있음 short

More information

11장 포인터

11장 포인터 Dynamic Memory and Linked List 1 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것 메모리의크기는프로그램이시작하기전에결정 int i, j; int buffer[80]; char name[] = data structure"; 처음에결정된크기보다더큰입력이들어온다면처리하지못함

More information

Chapter_06

Chapter_06 프로그래밍 1 1 Chapter 6. Functions and Program Structure April, 2016 Dept. of software Dankook University http://embedded.dankook.ac.kr/~baeksj 이장의강의목표 2 문자의입력방법을이해한다. 중첩된 if문을이해한다. while 반복문의사용법을익힌다. do 반복문의사용법을익힌다.

More information

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074> Chap #2 펌웨어작성을위한 C 언어 I http://www.smartdisplay.co.kr 강의계획 Chap1. 강의계획및디지털논리이론 Chap2. 펌웨어작성을위한 C 언어 I Chap3. 펌웨어작성을위한 C 언어 II Chap4. AT89S52 메모리구조 Chap5. SD-52 보드구성과코드메모리프로그래밍방법 Chap6. 어드레스디코딩 ( 매핑 ) 과어셈블리어코딩방법

More information

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C4C656D70656C2D5A69762E637070>

<443A5C4C C4B48555C B3E25C32C7D0B1E25CBCB3B0E8C7C1B7CEC1A7C6AE425CBED0C3E0C7C1B7CEB1D7B7A55C4C656D70656C2D5A69762E637070> /* */ /* LZWIN.C : Lempel-Ziv compression using Sliding Window */ /* */ #include "stdafx.h" #include "Lempel-Ziv.h" 1 /* 큐를초기화 */ void LZ::init_queue(void) front = rear = 0; /* 큐가꽉찼으면 1 을되돌림 */ int LZ::queue_full(void)

More information

Microsoft PowerPoint - 08-Queue.ppt

Microsoft PowerPoint - 08-Queue.ppt Chapter Queue ( 큐 ) Dongwon Jeong djeong@kunsan.ac.kr Department of Informatics & Statistics 학습목표 큐의개념및추상데이터타입에대한이해 큐의구현방법 배열 링크드리스트 덱 / 데크의개념과구현방법 큐 (QUEUE) 큐 : 먼저들어온데이터가먼저나가는자료구조 선입선출 (FIFO: First-In

More information

설계란 무엇인가?

설계란 무엇인가? 금오공과대학교 C++ 프로그래밍 jhhwang@kumoh.ac.kr 컴퓨터공학과 황준하 6 강. 함수와배열, 포인터, 참조목차 함수와포인터 주소값의매개변수전달 주소의반환 함수와배열 배열의매개변수전달 함수와참조 참조에의한매개변수전달 참조의반환 프로그래밍연습 1 /15 6 강. 함수와배열, 포인터, 참조함수와포인터 C++ 매개변수전달방법 값에의한전달 : 변수값,

More information

chap10.PDF

chap10.PDF 10 C++ Hello!! C C C++ C++ C++ 2 C++ 1980 Bell Bjarne Stroustrup C++ C C++ C, C++ C C 3 C C++ (prototype) (type checking) C C++ : C++ 4 C C++ (prototype) (type checking) [ 10-1] #include extern

More information

원형연결리스트에대한설명중틀린것은 모든노드들이연결되어있다 마지막에삽입하기가간단한다 헤더노드를가질수있다 최종노드포인터가 NULL이다 리스트의 번째요소를가장빠르게찾을수있는구현방법은무엇인가 배열 단순연결리스트 원형연결리스트 이중연결리스트 단순연결리스트의노드포인터 가마지막노드를

원형연결리스트에대한설명중틀린것은 모든노드들이연결되어있다 마지막에삽입하기가간단한다 헤더노드를가질수있다 최종노드포인터가 NULL이다 리스트의 번째요소를가장빠르게찾을수있는구현방법은무엇인가 배열 단순연결리스트 원형연결리스트 이중연결리스트 단순연결리스트의노드포인터 가마지막노드를 리스트에대한설명중틀린것은 구조체도리스트의요소가될수있다 리스트의요소간에는순서가있다 리스트는여러가지방법으로구현될수있다 리스트는집합과동일하다 다음은순차적표현과연결된표현을비교한것이다 설명이틀린것은 연결된표현은포인터를가지고있어상대적으로크기가작아진다 연결된표현은삽입이용이하다 순차적표현은연결된표현보다액세스시간이많이걸린다 연결된표현으로작성된리스트를 개로분리하기가쉽다 다음은연결리스트에서있을수있는여러가지경우를설명했는데잘못된항목은

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 MySQL - 명령어 1. 데이터베이스관련명령 2. 데이터베이스테이블관련명령 3. SQL 명령의일괄실행 4. 레코드관련명령 5. 데이터베이스백업및복원명령 1. 데이터베이스관련명령 데이터베이스접속명령 데이터베이스접속명령 mysql -u계정 -p비밀번호데이터베이스명 C: > mysql -ukdhong p1234 kdhong_db 데이터베이스생성명령 데이터베이스생성명령

More information

Microsoft PowerPoint - chap05-제어문.pptx

Microsoft PowerPoint - chap05-제어문.pptx int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); 1 학습목표 제어문인,, 분기문에 대해 알아본다. 인 if와 switch의 사용 방법과 사용시 주의사항에 대해 알아본다.

More information

1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout << " 양수입력 : "; cin >> *p; if (*p <= 0) cout << " 양수를입력해야합니다 " << endl; return; 동적할

1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout <<  양수입력 : ; cin >> *p; if (*p <= 0) cout <<  양수를입력해야합니다  << endl; return; 동적할 15 장기타주제들 auto_ptr 변환함수 cast 연산자에의한명시적형변환실행시간타입정보알아내기 (RTTI) C++ 프로그래밍입문 1. auto_ptr 다음프로그램의문제점은무엇인가? void func(void) int *p = new int; cout > *p; if (*p

More information

ABC 10장

ABC 10장 10 장구조체와리스트처리 0 자기참조구조체 자기참조구조체는자기자신의형을참조하는포인터멤버를가짐 이러한자료구조를동적자료구조라고함 배열이나단순변수는일반적으로블록을진입할때메모리할당을받지만, 동적자료구조는기억장소관리루틴을사용하여명시적으로메모리할당을요구함 10-1 자기참조구조체 10-2 자기참조구조체 예제 struct list { int struct list a; data;

More information

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어 개나리 연구소 C 언어 노트 (tyback.egloos.com) 프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어먹고 하더라구요. 그래서,

More information

Microsoft PowerPoint - 9ÀÏ°_ÂüÁ¶ÀÚ.ppt

Microsoft PowerPoint - 9ÀÏ°_ÂüÁ¶ÀÚ.ppt 참조자 - 참조자란무엇인가? - 참조자는어떻게만들고사용하는가? - 참조자는포인터와무엇이다른가? 1 참조자 (reference) 란? 참조자 : 객체 ( 타겟 ) 에대한다른이름 ( 별칭 ) 참조자의변화는타겟의변화 참조자만들고반드시초기화 참조자생성 형참조연산자 (&) 참조자이름 = 초기화타겟명 모든항목필수 예 ) int &rsomeref = someint ; 참조자에대한주소연산자

More information

Microsoft PowerPoint - additional01.ppt [호환 모드]

Microsoft PowerPoint - additional01.ppt [호환 모드] 1.C 기반의 C++ part 1 함수 오버로딩 (overloading) 디폴트매개변수 (default parameter) 인-라인함수 (in-line function) 이름공간 (namespace) Jong Hyuk Park 함수 Jong Hyuk Park 함수오버로딩 (overloading) 함수오버로딩 (function overloading) C++ 언어에서는같은이름을가진여러개의함수를정의가능

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Chapter 12 표준입출력과파일입출력... 1. 표준입출력함수 2. 파일입출력함수 1. 표준입출력함수 표준입출력함수 표준입력 (stdin, Standard Input) : 키보드입력 표준출력 (stdout, StandardOutput) : 모니터출력 1. 표준입출력함수 서식화된입출력함수 printf(), scanf() 서식의위치에올수있는것들 [ 기본 11-1]

More information

1. 표준입출력 C++ : C의모든라이브러리를포함 printf, scanf 함수사용가능예 : int, double, 문자열값을입력받고출력하기 #include <cstdio> int ivar; double dvar; char str[20]; printf("int, dou

1. 표준입출력 C++ : C의모든라이브러리를포함 printf, scanf 함수사용가능예 : int, double, 문자열값을입력받고출력하기 #include <cstdio> int ivar; double dvar; char str[20]; printf(int, dou 2 장더나은 C 로서의 C++ (1) 표준입출력네임스페이스 ( 고전 C++ 와표준 C++) 함수오버로딩디폴트매개변수 new와 delete bool 자료형 C++ is not C C++ 프로그래밍입문 1. 표준입출력 C++ : C의모든라이브러리를포함 printf, scanf 함수사용가능예 : int, double, 문자열값을입력받고출력하기 #include

More information

Microsoft PowerPoint - Chapter 6.ppt

Microsoft PowerPoint - Chapter 6.ppt 6.Static 멤버와 const 멤버 클래스와 const 클래스와 static 연결리스트프로그램예 Jong Hyuk Park 클래스와 const Jong Hyuk Park C 의 const (1) const double PI=3.14; PI=3.1415; // 컴파일오류 const int val; val=20; // 컴파일오류 3 C 의 const (1)

More information

歯9장.PDF

歯9장.PDF 9 Hello!! C printf() scanf() getchar() putchar() gets() puts() fopen() fclose() fprintf() fscant() fgetc() fputs() fgets() gputs() fread() fwrite() fseek() ftell() I/O 2 (stream) C (text stream) : `/n'

More information

BMP 파일 처리

BMP 파일 처리 BMP 파일처리 김성영교수 금오공과대학교 컴퓨터공학과 학습내용 영상반전프로그램제작 2 Inverting images out = 255 - in 3 /* 이프로그램은 8bit gray-scale 영상을입력으로사용하여반전한후동일포맷의영상으로저장한다. */ #include #include #define WIDTHBYTES(bytes)

More information

2007_2_project4

2007_2_project4 Programming Methodology Instructor: Kyuseok Shim Project #4: external sort with template Due Date: 0:0 a.m. between 2007-12-2 & 2007-12-3 Introduction 이프로젝트는 C++ 의 template을이용한 sorting algorithm과정렬해야할데이터의크기가

More information

8 장데이터베이스 8.1 기본개념 - 데이터베이스 : 데이터를조직적으로구조화한집합 (cf. 엑셀파일 ) - 테이블 : 데이터의기록형식 (cf. 엑셀시트의첫줄 ) - 필드 : 같은종류의데이터 (cf. 엑셀시트의각칸 ) - 레코드 : 데이터내용 (cf. 엑셀시트의한줄 )

8 장데이터베이스 8.1 기본개념 - 데이터베이스 : 데이터를조직적으로구조화한집합 (cf. 엑셀파일 ) - 테이블 : 데이터의기록형식 (cf. 엑셀시트의첫줄 ) - 필드 : 같은종류의데이터 (cf. 엑셀시트의각칸 ) - 레코드 : 데이터내용 (cf. 엑셀시트의한줄 ) 8 장데이터베이스 8.1 기본개념 - 데이터베이스 : 데이터를조직적으로구조화한집합 (cf. 엑셀파일 ) - 테이블 : 데이터의기록형식 (cf. 엑셀시트의첫줄 ) - 필드 : 같은종류의데이터 (cf. 엑셀시트의각칸 ) - 레코드 : 데이터내용 (cf. 엑셀시트의한줄 ) - DDL(Data Definition Language) : show, create, drop

More information

chap7.key

chap7.key 1 7 C 2 7.1 C (System Calls) Unix UNIX man Section 2 C. C (Library Functions) C 1975 Dennis Ritchie ANSI C Standard Library 3 (system call). 4 C?... 5 C (text file), C. (binary file). 6 C 1. : fopen( )

More information

<4D F736F F F696E74202D20C1A63132B0AD20B5BFC0FB20B8DEB8F0B8AEC7D2B4E7>

<4D F736F F F696E74202D20C1A63132B0AD20B5BFC0FB20B8DEB8F0B8AEC7D2B4E7> 제14장 동적 메모리 할당 Dynamic Allocation void * malloc(sizeof(char)*256) void * calloc(sizeof(char), 256) void * realloc(void *, size_t); Self-Referece NODE struct selfref { int n; struct selfref *next; }; Linked

More information

2015 개정교육과정에따른정보과평가기준개발연구 연구책임자 공동연구자 연구협력관

2015 개정교육과정에따른정보과평가기준개발연구 연구책임자 공동연구자 연구협력관 2015 개정교육과정에따른정보과평가기준개발연구 연구책임자 공동연구자 연구협력관 2015 개정교육과정에따른정보과평가기준개발연구 연구협력진 머리말 연구요약 차례 Ⅰ 서론 1 Ⅱ 평가준거성취기준, 평가기준, 성취수준, 예시평가도구개발방향 7 Ⅲ 정보과평가준거성취기준, 평가기준, 성취수준, 예시평가도구의개발 25 Ⅳ 정보과평가준거성취기준, 평가기준, 성취수준, 예시평가도구의활용방안

More information

Microsoft PowerPoint - 08-chap06-Queue.ppt

Microsoft PowerPoint - 08-chap06-Queue.ppt / 큐 (QUEUE) Chapter 큐 : 먼저들어온데이터가먼저나가는자료구조 선입선출 (FIFO: First-In First-Out) ( 예 ) 매표소의대기열 큐 Ticket ox Dongwon Jeong djeong@kunsan.ac.kr Department of Kunsan National University 전단 () 후단 () 학습목표 큐 DT 큐의개념및추상데이터타입에대한이해

More information

1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 #define _CRT_SECURE_NO_WARNINGS #include #include main() { char ch; printf(" 문자 1개를입력하시오 : "); scanf("%c", &ch); if (isalpha(ch))

More information

슬라이드 1

슬라이드 1 CHAP 6: 큐 큐 (QUEUE) 큐 : 먼저들어온데이터가먼저나가는자료구조 선입선출 (FIFO: First-In First-Out) ( 예 ) 매표소의대기열 Ticket Box 전단 (front) 후단 (rear) 큐 ADT 삽입과삭제는 FIFO 순서를따른다. 삽입은큐의후단에서, 삭제는전단에서이루어진다. 객체 : n 개의 element 형으로구성된요소들의순서있는모임

More information

슬라이드 1

슬라이드 1 -Part3- 제 4 장동적메모리할당과가변인 자 학습목차 4.1 동적메모리할당 4.1 동적메모리할당 4.1 동적메모리할당 배울내용 1 프로세스의메모리공간 2 동적메모리할당의필요성 4.1 동적메모리할당 (1/6) 프로세스의메모리구조 코드영역 : 프로그램실행코드, 함수들이저장되는영역 스택영역 : 매개변수, 지역변수, 중괄호 ( 블록 ) 내부에정의된변수들이저장되는영역

More information

untitled

untitled while do-while for break continue while( ) ; #include 0 i int main(void) int meter; int i = 0; while(i < 3) meter = i * 1609; printf("%d %d \n", i, meter); i++; return 0; i i< 3 () 0 (1)

More information

PowerPoint Template

PowerPoint Template 18 동적할당과고급처리 인터넷정보과 1 2/19 동적할당 목적 다음과같은일반변수의선언과사용은변수를정적 (static) 으로사용 int a = 10; 메모리사용예측이부정확한경우는충분한메모리를미리확보해야하는것은비효율 동적 (dynamic) 메모리할당 (Memory Allocation) 동적인메모리할당을위해서는함수 malloc() 을이용, 메모리공간을확보 함수 malloc()

More information

Microsoft PowerPoint - additional08.ppt [호환 모드]

Microsoft PowerPoint - additional08.ppt [호환 모드] 8. 상속과다형성 (polymorphism) 상속된객체와포인터 / 참조자의관계 정적바인딩과동적바인딩 virtual 소멸자 Jong Hyuk Park 상속의조건 public 상속은 is-a 관계가성립되도록하자. 일반화 ParttimeStd 구체화 2 상속의조건 잘못된상속의예 현실세계와완전히동떨어진모델이형성됨 3 상속의조건 HAS-A( 소유 ) 관계에의한상속!

More information

Chap 6: Graphs

Chap 6: Graphs 그래프표현법 인접행렬 (Adjacency Matrix) 인접리스트 (Adjacency List) 인접다중리스트 (Adjacency Multilist) 6 장. 그래프 (Page ) 인접행렬 (Adjacency Matrix) n 개의 vertex 를갖는그래프 G 의인접행렬의구성 A[n][n] (u, v) E(G) 이면, A[u][v] = Otherwise, A[u][v]

More information

제 1 장 기본 개념

제 1 장 기본 개념 제 1 장기본개념 시스템생명주기 (System Life Cycle) 1. 요구사항 (requirement) 프로젝트들의목적을정의한명세들의집합 입력과출력에관한정보를기술 2. 분석 (analysis) 문제들을다룰수있는작은단위들로나눔 상향식 (bottom-up)/ 하향식 (top-down) 접근방법 3. 설계 (design) 추상데이타타입 (abstract data

More information

o 스택 (stack) ~ 쌓아놓은더미 1. 스택의개요 - 2 -

o 스택 (stack) ~ 쌓아놓은더미 1. 스택의개요 - 2 - 스택 (stack) SANGJI University Kwangman Ko o 스택 (stack) ~ 쌓아놓은더미 1. 스택의개요 - 2 - o 스택의특징 ~ 모든원소의삽입과삭제가 top 이라는자료구조의한쪽끝에서만수행되는제한된리스트구조 ~ 후입선출 (Last-In-First-Out, LIFO) 방식 가장마지막에입력된자료가가장먼저출력 o 스택의동작 ~ top 에서만삽입

More information