1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #include <stdio.h> #include <string.h> #include <stdlib.h> #define LEN 100 #define SIZE 1000 typedef struct Person{ char name[LEN]; char address[LEN]; char phone[LEN]; char feature[LEN]; } Person; void load(int* _count, Person arr[SIZE]); void addPerson(Person arr[SIZE]); void searchByName(Person arr[SIZE]); Person* searchAndViewInfo(Person arr[SIZE]); void searchAndRewrite(Person arr[SIZE]); void searchAndDelete(Person arr[SIZE]); void saveAndQuit(Person arr[SIZE]); void fflushReadBuffer(void); void strClear(char* str); int count = 0; int main(void){ Person persons[SIZE] = { '\0', }; char input; printf("주소록 프로그램\n\n"); load(&count, persons); while(1){ printf("\n\n--------------------\n"); printf("1. 추가\n"); printf("2. 검색\n"); printf("3. 수정\n"); printf("4. 삭제\n"); printf("5. 종료\n"); printf("--------------------\n"); printf("메뉴를 선택하세요: \n"); scanf("%c", &input); switch(input){ case '1': addPerson(persons); break; case '2': searchAndViewInfo(persons); break; //search by name. case '3': searchAndRewrite(persons); break; case '4': searchAndDelete(persons); break; case '5': saveAndQuit(persons); break; default: break; } fflushReadBuffer(); } return 0; } | cs |
야! 리포트 끘!
과제이기 때문에 껍데기만 보여두립니다
1. 새로운 시작
주소록 프로그램
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
로드를 위한 파일을 열 수 없습니다.
초기화된 상태에서 시작합니다.
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
1
이름: asd
주소: asd sdadas s
전화: 123 123 22
특징: aa aaaa aa
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
2
찾을 사람의 이름을 입력하시오: asd
이름: asd
주소: asd sdadas s
전화: 123 123 22
특징: aa aaaa aa
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
1
이름: jane
주소: nope
전화: 010-1010-0101
특징: she is dirty.
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
2
찾을 사람의 이름을 입력하시오: jane
이름: jane
주소: nope
전화: 010-1010-0101
특징: she is dirty.
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
2
찾을 사람의 이름을 입력하시오: asdf
이름이 asdf인 사람은 주소록에 존재하지 않습니다
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
1
이름: third
주소: 3
전화: 333-3333-3333
특징: feature
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
3
찾을 사람의 이름을 입력하시오: asd
이름: asd
주소: asd sdadas s
전화: 123 123 22
특징: aa aaaa aa
<!--[if !supportEmptyParas]--> <!--[endif]-->
***이 사람의 정보를 고쳐 씁니다***
<!--[if !supportEmptyParas]--> <!--[endif]-->
이름: 1
주소: 1
전화: 1
특징: 1
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
2
찾을 사람의 이름을 입력하시오: 1
이름: 1
주소: 1
전화: 1
특징: 1
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
3
찾을 사람의 이름을 입력하시오: 1
이름: 1
주소: 1
전화: 1
특징: 1
<!--[if !supportEmptyParas]--> <!--[endif]-->
***이 사람의 정보를 고쳐 씁니다***
<!--[if !supportEmptyParas]--> <!--[endif]-->
이름: null
주소: noll
전화: nolll
특징: njljoi 1212
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
4
찾을 사람의 이름을 입력하시오: null
이름: null
주소: noll
전화: nolll
특징: njljoi
<!--[if !supportEmptyParas]--> <!--[endif]-->
***주소록에서 이 사람을 삭제합니다.***
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
2
찾을 사람의 이름을 입력하시오: null
이름이 null인 사람은 주소록에 존재하지 않습니다
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
5
계속하려면 아무 키나 누르십시오 . . .
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
2. 2번째
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
주소록 프로그램
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
주소록 데이터파일 로드 완료
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
2
찾을 사람의 이름을 입력하시오: jane
이름: jane
주소: nope
전화: 010-1010-0101
특징: she is dirty.
<!--[if !supportEmptyParas]--> <!--[endif]-->
<!--[if !supportEmptyParas]--> <!--[endif]-->
--------------------
1. 추가
2. 검색
3. 수정
4. 삭제
5. 종료
--------------------
메뉴를 선택하세요:
2
찾을 사람의 이름을 입력하시오: third
이름: third
디시 애미디진.....
ㄴㅋㅋㅋㅋㅋ