실행화면

주차안내프로그램 실행예.txt

주차안내프로그램 실행예.txt
1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 1 > 차번 입력(숫자 4자리) : 1111 @ 주차 가능 공간 : B1층[10대] B2층[10대] B3층[10대] [B1층]============================ [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : 1 @ 주차되었습니다! 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 1 > 차번 입력(숫자 4자리) : 2222 @ 주차 가능 공간 : B1층[9대] B2층[10대] B3층[10대] [B1층]============================ [1111] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : 0 [B2층]============================ [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : 2 @ 주차되었습니다! 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 1 > 차번 입력(숫자 4자리) : 3333 @ 주차 가능 공간 : B1층[9대] B2층[9대] B3층[10대] [B1층]============================ [1111] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : 0 [B2층]============================ [ 1 ] [2222] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : 0 [B3층]============================ [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : 0 [B2층]============================ [ 1 ] [2222] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : 3 @ 주차되었습니다! 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 3 > 층과 번호 입력(종료 0) : 1 4 > 등록차량 번호 입력 : 1004 @ 등록되었습니다. > 층과 번호 입력(종료 0) : 1 5 > 등록차량 번호 입력 : 1005 @ 등록되었습니다. > 층과 번호 입력(종료 0) : 2 10 > 등록차량 번호 입력 : 2010 @ 등록되었습니다. > 층과 번호 입력(종료 0) : 0 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 1 > 차번 입력(숫자 4자리) : 4444 @ 주차 가능 공간 : B1층[7대] B2층[7대] B3층[10대] [B1층]============================ [1111] [ 2 ] [ 3 ] [resv] [resv] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : 0 [B2층]============================ [ 1 ] [2222] [3333] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [resv] > 주차 번호 입력(다른층 0, 취소 -1) : 0 [B3층]============================ [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : 7 @ 주차되었습니다! 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 1 > 차번 입력(숫자 4자리) : 1004 @ 지정차량 : B1층 4번 주차했습니다. 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 5 [B1층]============================ [1111] [ 2 ] [ 3 ] [1004] [resv] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [B2층]============================ [ 1 ] [2222] [3333] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [resv] [B3층]============================ [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [4444] [ 8 ] [ 9 ] [ 10 ] 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 2 > 차번 입력(숫자 4자리) : 5555 @ 해당 차량이 없습니다. 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 2 > 차번 입력(숫자 4자리) : 1004 @ 출차되었습니다. 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 1 > 차번 입력(숫자 4자리) : 1005 @ 지정차량 : B1층 5번 주차했습니다. 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 5 [B1층]============================ [1111] [ 2 ] [ 3 ] [resv] [1005] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [B2층]============================ [ 1 ] [2222] [3333] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [resv] [B3층]============================ [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [4444] [ 8 ] [ 9 ] [ 10 ] 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 1 > 차번 입력(숫자 4자리) : 5555 @ 주차 가능 공간 : B1층[7대] B2층[7대] B3층[9대] [B1층]============================ [1111] [ 2 ] [ 3 ] [resv] [1005] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] > 주차 번호 입력(다른층 0, 취소 -1) : -1 1. 주차 2. 출차 3. 지정차량 등록 4. 지정차량 해제 5. 주차현황 출력 0. 종료 > 번호 선택 : 0
실행화면
테스트케이스
번호
|
테스트 항목
|
확인
|
비고
| |
YES
|
NO
| |||
메뉴시연
| ||||
1
|
번호 입력시 1~6외에 숫자 입력
|
○
| ||
2
|
6입력시 종료가 되는지
|
○
| ||
3
|
숫자 이외에 문자 입력
|
○
| ||
주차
| ||||
1
|
주차 가능 공간 확인(문자포함)
|
○
| ||
2
|
0, -1, 주차번호외의 번호 입력시
|
○
| ||
3
|
주차가 되어있는 공간 선택시
|
○
| ||
4
|
지정되어 있는 공간 선택시
|
○
| ||
5
|
주차 차량 번호 4자리 외에 입력시(문자포함)
|
○
| ||
6
|
차량번호 중복 주차시
|
○
| ||
7
|
지하1~3층 후 3~1로 올라오는지
|
○
| ||
출차
| ||||
1
|
없는 차량번호 출차시
|
○
| ||
2
|
출차시 일반차량, 지정차량 확인이 되는지
|
○
| ||
3
|
1~10번을 입력 했을시에..
|
○
| ||
지정차량 등록
| ||||
1
|
이미 주차된곳 선택시
|
○
| ||
2
|
지정차량 등록후 다른차량번호로 주차시
|
○
| ||
3
|
지정된 자리에 중복되어 지정차량 재등록시
|
○
| ||
4
|
층과 번호 입력시(문자포함)
|
O
| ||
지정차량 삭제
| ||||
1
|
지정차량 주차중 삭제시 주차차량 유지되는지
|
○
| ||
2
|
지정차량 지정번호가 아닌 다른번호 삭제시
|
O
| ||
3
|
지정차량번호 외 다른번호 삭제시
|
○
| ||
현황 출력
| ||||
1
|
주차 가능수 잘 나오는지
|
○
|
C언어 코딩
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630 #include <stdio.h>#include <Windows.h>#include <stdlib.h>#include <time.h>#include <string.h>// 1번 일반차량 파킹인void parking(char area[][10][5], int floor, int choice, char carNumber[], int areaCheck[][10]);// 2번 일반차량 파킹아웃void out(char area[][10][5], char carNumber[], int areaCheck[][10]);// 3번 지정차량 등록void registerCar(char area[][10][5], int floor, int choice, char carNumber[5], char registerCarCheck[][10][5], int registerAreaCheck[][10]);// 4번 지정차량 등록해제void registerRemove(char area[][10][5], int *tempFloor, int *tempChoice, char carNumber[5], char registerCarCheck[][10][5], int registerAreaCheck[][10]);// 5번 주차현황 출력void show(char area[][10][5]);// 파킹 전체적인 현재 상태void parkingArea1(char area[][10][5]);// 파킹 세부적인 상태void parkingArea2(char area[][10][5], int floor);// 지정차량체크int registerCheck(char registerCarCheck[][10][5], int *tempFloor, int *tempChoice, char carNumber[]);// 지정차량 파킹인void registerParking(char area[][10][5], int *tempFloor, int *tempChoice, char carNumber[]);// 지정차량 파킹아웃void outRegisterCar(char area[][10][5], int *tempFloor, int *tempChoice, char carNumber[]);// 차량 주차 체크int CheckCar(int areaCheck[][10], int registerAreaCheck[][10], int floor, int choice);// 차량 넘버 중복 체크int CheckCarNumber(char area[][10][5], char registerCarCheck[][10][5], char carNumber[5]);int main(void) {// 일반차량 및 보여주기를 위한 배열char area[3][10][5] = {{ "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" }};// 등록차량을 위한 배열char registerCarCheck[3][10][5] = {{ "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" }};// 일반차량 등록 장소int areaCheck[3][10] = {{ 0,0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0,0 }};// 지정차량 등록 장소int registerAreaCheck[3][10] = {{ 0,0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0,0 },{ 0,0,0,0,0,0,0,0,0,0 }};char stateInput[30]; // 메인 메뉴 선택시 에러 체크 변수1int stateInputCount = 0; // 메인 메뉴 선택시 에러 체크 변수2int state = 1; // 메인 메뉴 선택 변수char carNumber[5]; // 차량넘버int carNumberCheck = 0; // 차량넘버 에러 체크 변수1int carNumberCount = 0; // 차량넘버 에러 체크 변수2// 주차(case1) : 주차 번호 입력(다른층 0, 취소 -1)char floorAndchoice[30]; // 주차 번호 입력 관련 에러 체크 변수1int floorAndchoiceErrorCheck = 0; // 주차 번호 입력 관련 에러 체크 변수2int floorAndchoiceMinuseCheck = 0; // 주차 번호 입력 관련 -1 체크 변수// 등록(case3) : 층과 번호 입력(종료 0)char floorChoice[30];int floorChoiceCount = 0;int floorChoiceError = 0;int floor = 0; // 층 선택int choice = 0; // 자리 선택int *tempFloor = 0; // 등록차량 관련 일시적인 층 선택int *tempChoice = 0; // 등록차량 관련 일시적인 자리 선택int upDown = 0; // 1번 주차에서 0번눌렀을시에 다른층 왔다갔다 하는것을 도와주는 변수// 0번 선택시 while문 종료while (state) {printf("1. 주차\n");printf("2. 출차\n");printf("3. 지정차량 등록\n");printf("4. 지정차량 해제\n");printf("5. 주차현황 출력\n");printf("0. 종료\n");scanf_s("%s", &stateInput, sizeof(stateInput));// 잘못된 값 입력 판별for (int i = 0; i < sizeof(stateInput) / sizeof(char); i++) {if (stateInput[i] == ' ') continue;else if (stateInput[i] >= '0' && stateInput[i] < '6') {stateInputCount++;state = stateInput[i] - '0';}else if (stateInput[i] == '\0') break;else {stateInputCount = 2;}}// 잘못된 값을 입력했을 시에 실행if (stateInputCount > 1) {printf("잘못 입력하셨습니다.\n");stateInputCount = 0;continue;}switch (state) {case 1:printf("차번 입력(숫자 4자리) : ");scanf_s("%s", &carNumber, sizeof(carNumber));// 잘못된 값 입력 판별for (int i = 0; i < sizeof(carNumber) / sizeof(char) - 1; i++) {if (carNumber[i] >= '0' && carNumber[i] <= '9') {carNumberCount++;}else {carNumberCheck = 1;}}// 잘못된 값 입력시if (carNumberCheck == 1 || carNumberCount != 4) {printf("잘못 입력하셨습니다.\n");carNumberCheck = 0;}// 중복된 차량번호라면else if (CheckCarNumber(area, registerCarCheck, carNumber)) {printf("중복된 차량번호가 있습니다.\n\n");}// 제대로 된 값을 입력했다면else if (carNumberCheck == 0) {// 지정차량이라면if (registerCheck(registerCarCheck, &tempFloor, &tempChoice, carNumber)) {registerParking(area, &tempFloor, &tempChoice, carNumber);}// 지정차량이 아니라면else {// 주차 가능 공간 함수parkingArea1(area);while (1) {// 현재 층 상태 함수parkingArea2(area, floor);printf("> 주차 번호 입력(다른층 0, 취소 -1) : ");scanf_s(" %[^\n]s", &floorAndchoice, sizeof(floorAndchoice));// 잘못된 값 입력 판별for (int i = 0; i < sizeof(floorAndchoice) / sizeof(char) - 1; i++) {if (floorAndchoice[i] == ' ') continue;else if (floorAndchoice[i] == '-') floorAndchoiceMinuseCheck = 1;else if (floorAndchoice[i] >= '0' && floorAndchoice[i] <= '9') {choice *= 10;choice = choice + (floorAndchoice[i] - '0');}else if (floorAndchoice[i] == '\0') break;else {floorAndchoiceErrorCheck = 1;}}// -값이 있을시에if (floorAndchoiceMinuseCheck == 1) {choice *= -1;}// 0~9를 제외한 다른 숫자를 입력했을 시에if (floorAndchoiceErrorCheck == 1) {printf("잘못된 값 입력하셨습니다.\n");}else {// 0 다른층if (choice == 0) {if (upDown == 0) floor++;else if (upDown == 1) floor--;if (floor == 0) upDown = 0;else if (floor == 2) upDown = 1;}// -1 취소else if (choice == -1) break;// 자리 선택else if (choice>0 && choice<11) {if (CheckCar(areaCheck, registerAreaCheck, floor, choice)) {printf("다른 자리를 선택하세요.\n");}else {parking(area, floor, choice, carNumber, areaCheck);break;}}else {printf("잘못된 값을 입력하셨습니다.\n");}}// 잘못된 값 입력시 초기화choice = 0;floorAndchoiceMinuseCheck = 0;floorAndchoiceErrorCheck = 0;}}}break;case 2:while (1) {printf("> 차번 입력(숫자 4자리) : ");scanf_s("%s", &carNumber, sizeof(carNumber));// 잘못된 값 입력 판별for (int i = 0; i < sizeof(carNumber) / sizeof(char) - 1; i++) {if (carNumber[i] >= '0' && carNumber[i] <= '9') {carNumberCount++;}else {carNumberCheck = 1;}}// 잘못된 값 입력시if (carNumberCheck == 1 || carNumberCount != 4) {printf("잘못 입력하셨습니다.\n");carNumberCheck = 0;}// 지정차량이라면else if (registerCheck(registerCarCheck, &tempFloor, &tempChoice, carNumber)) {// 지정차량 아웃outRegisterCar(area, &tempFloor, &tempChoice, carNumber);break;}else {// 그냥 차량 아웃out(area, carNumber, areaCheck);break;}carNumberCount = 0;}break;case 3:printf("> 층과 번호 입력(종료 0) : ");scanf_s(" %[^\n]s", &floorChoice, sizeof(floorChoice));for (int i = 0; i < sizeof(floorChoice) / sizeof(char)-1; i++) {if (floorChoice[i] == ' ') continue;if (floorChoice[i] >= '0' && floorChoice[i] <= '9') {printf("floorChoice : %c\n", floorChoice[i]);if (floorChoiceCount == 0) floor = floorChoice[i] - '0';else if (floorChoiceCount == 1) choice = floorChoice[i] - '0';else if (floorChoiceCount == 2){floorChoiceError = 1;}floorChoiceCount++;}else if (floorChoice[i] == '\0') break;else {printf("floorChoice : %c\n", floorChoice[i]);floorChoiceError = 1;}}if (floorChoiceError == 1) printf("잘못입력하셨습니다.\n");else if (CheckCar(areaCheck, registerAreaCheck, floor - 1, choice)) {printf("다른 자리를 선택해 주세요.\n\n");}else if (floor != 0) {printf("> 등록차량 번호 입력 : ");scanf_s("%s", &carNumber, sizeof(carNumber));// 중복된 차량번호라면if (CheckCarNumber(area, registerCarCheck, carNumber)) {printf("중복된 차량번호가 있습니다.\n\n");}else {registerCar(area, floor, choice, carNumber, registerCarCheck, registerAreaCheck);}}break;case 4:printf("> 차번 입력(숫자 4자리) : ");scanf_s("%s", &carNumber, sizeof(carNumber));if (registerCheck(registerCarCheck, &tempFloor, &tempChoice, carNumber)) {registerRemove(area, &tempFloor, &tempChoice, carNumber, registerCarCheck, registerAreaCheck);printf("%s의 차량이 B%d층의 %d번 자리에서 지정차량 등록해제되었습니다.\n\n", carNumber, tempFloor + 1, tempChoice + 1);}else {printf("지정차량이 없습니다.");}break;case 5:// 주차 현황show(area);break;}// 초기화choice = 0;floor = 0;upDown = 0;stateInputCount = 0;carNumberCount = 0;floorAndchoiceErrorCheck = 0;floorAndchoiceMinuseCheck = 0;floorChoiceCount = 0;floorChoiceError = 0;for (int i = 0; i < 5; i++) {carNumber[i] = '\0';}}system("pause");return 0;}// 차량 파킹void parking(char area[][10][5], int floor, int choice, char carNumber[], int areaCheck[][10]) {printf("@ 주차되었습니다!\n");for (int i = 0; i < 4; i++) {area[floor][choice - 1][i] = carNumber[i];}areaCheck[floor][choice - 1] = 1;}// 지정차량체크int registerCheck(char registerCarCheck[][10][5], int *tempFloor, int *tempChoice, char carNumber[]) {int check = 0;for (int i = 0; i < 3; i++) {for (int j = 0; j < 10; j++) {// 두개 문자열이 같다면if (!strcmp(registerCarCheck[i][j], carNumber)) {check = 1;*tempFloor = i;*tempChoice = j;return 1;}}}if (check == 0) return 0;}// 지정차량 파킹인void registerParking(char area[][10][5], int *tempFloor, int *tempChoice, char carNumber[]) {printf("@ 지정차량 : B%d층 %d번 주차했습니다.\n", *tempFloor + 1, *tempChoice + 1);for (int i = 0; i < 4; i++) {area[*tempFloor][*tempChoice][i] = carNumber[i];}}// 지정차량 파킹아웃void outRegisterCar(char area[][10][5], int *tempFloor, int *tempChoice, char carNumber[]) {printf("@ 지정차량이 나갔습니다.\n", *tempFloor + 1, *tempChoice + 1);area[*tempFloor][*tempChoice][0] = 'r';area[*tempFloor][*tempChoice][1] = 'e';area[*tempFloor][*tempChoice][2] = 's';area[*tempFloor][*tempChoice][3] = 'v';}// 1번 파킹 전체적인 현 상태void parkingArea1(char area[][10][5]) {int sum;printf("@ 주차 가능 공간 : ");for (int i = 0; i < 3; i++) {sum = 0;printf("B%d층", i + 1);for (int j = 0; j < 10; j++) {if (area[i][j][2] == '\0') sum += 1;}printf("[%d대] ", sum);}printf("\n");}// 1번 파킹 세부적인 상태void parkingArea2(char area[][10][5], int floor) {printf("B%d층======================================\n", floor + 1);for (int i = 0; i < 10; i++) {printf("[%s] ", area[floor][i]);}printf("\n\n");}// 2번 일반차량 아웃void out(char area[][10][5], char carNumber[], int areaCheck[][10]) {int outCar = 0;for (int i = 0; i < 3; i++) {for (int j = 0; j < 10; j++) {// 두개 문자열이 같다면if (!strcmp(area[i][j], carNumber)) {areaCheck[i][j] = 0;// 초기화for (int k = 0; k < 4; k++) {area[i][j][k] = '\0';}// 번호 재지정switch (j) {case 0:area[i][j][0] = '1';break;case 1:area[i][j][0] = '2';break;case 2:area[i][j][0] = '3';break;case 3:area[i][j][0] = '4';break;case 4:area[i][j][0] = '5';break;case 5:area[i][j][0] = '6';break;case 6:area[i][j][0] = '7';break;case 7:area[i][j][0] = '8';break;case 8:area[i][j][0] = '9';break;case 9:area[i][j][0] = '1';area[i][j][1] = '0';break;}// 출차 완료printf("@ 출차되었습니다.\n");outCar = 1;}}}if (outCar == 0) printf("@ 해당 차량이 없습니다.\n\n");}// 3번 지정차량 등록void registerCar(char area[][10][5], int floor, int choice, char carNumber[5], char registerCarCheck[][10][5], int registerAreaCheck[][10]) {area[floor - 1][choice - 1][0] = 'r';area[floor - 1][choice - 1][1] = 'e';area[floor - 1][choice - 1][2] = 's';area[floor - 1][choice - 1][3] = 'v';for (int i = 0; i < 4; i++) {registerCarCheck[floor - 1][choice - 1][i] = carNumber[i];}registerAreaCheck[floor - 1][choice - 1] = 1;}// 4번 지정차량 등록해제void registerRemove(char area[][10][5], int *tempFloor, int *tempChoice, char carNumber[5], char registerCarCheck[][10][5], int registerAreaCheck[][10]) {// area 초기화// area의 해당 자리에 차가 있다면if (!strcmp(area[*tempFloor][*tempChoice], carNumber)) {for (int i = 0; i < 4; i++) {area[*tempFloor][*tempChoice][i] = carNumber[i];}registerAreaCheck[*tempFloor][*tempChoice] = 0;}// area의 해당 자리에 차가 없다면else {for (int i = 0; i < 4; i++) {area[*tempFloor][*tempChoice][i] = '\0';}switch (*tempChoice) {case 0:area[*tempFloor][*tempChoice][0] = '1';break;case 1:area[*tempFloor][*tempChoice][0] = '2';break;case 2:area[*tempFloor][*tempChoice][0] = '3';break;case 3:area[*tempFloor][*tempChoice][0] = '4';break;case 4:area[*tempFloor][*tempChoice][0] = '5';break;case 5:area[*tempFloor][*tempChoice][0] = '6';break;case 6:area[*tempFloor][*tempChoice][0] = '7';break;case 7:area[*tempFloor][*tempChoice][0] = '8';break;case 8:area[*tempFloor][*tempChoice][0] = '9';break;case 9:area[*tempFloor][*tempChoice][0] = '1';area[*tempFloor][*tempChoice][1] = '0';break;}}// registerCarCheck 초기화for (int i = 0; i < 4; i++) {registerCarCheck[*tempFloor][*tempChoice][i] = '\0';}switch (*tempChoice) {case 0:registerCarCheck[*tempFloor][*tempChoice][0] = '1';break;case 1:registerCarCheck[*tempFloor][*tempChoice][0] = '2';break;case 2:registerCarCheck[*tempFloor][*tempChoice][0] = '3';break;case 3:registerCarCheck[*tempFloor][*tempChoice][0] = '4';break;case 4:registerCarCheck[*tempFloor][*tempChoice][0] = '5';break;case 5:registerCarCheck[*tempFloor][*tempChoice][0] = '6';break;case 6:registerCarCheck[*tempFloor][*tempChoice][0] = '7';break;case 7:registerCarCheck[*tempFloor][*tempChoice][0] = '8';break;case 8:registerCarCheck[*tempFloor][*tempChoice][0] = '9';break;case 9:registerCarCheck[*tempFloor][*tempChoice][0] = '1';registerCarCheck[*tempFloor][*tempChoice][1] = '0';break;}}// 5번 주차현황 출력void show(char area[][10][5]) {for (int i = 0; i < 3; i++) {printf("B%d층======================================\n", i + 1);for (int j = 0; j < 10; j++) {printf("[%s] ", area[i][j]);}printf("\n\n");}}// 차량 넘버 중복 체크int CheckCarNumber(char area[][10][5], char registerCarCheck[][10][5], char carNumber[5]) {int result = 0;for (int i = 0; i < 3; i++) {for (int j = 0; j < 10; j++) {if (!strcmp(area[i][j], carNumber)) result = 1;else if (!strcmp(registerCarCheck[i][j], carNumber)) result = 1;}}return result;}// 차량 주차 체크int CheckCar(int areaCheck[][10], int registerAreaCheck[][10], int floor, int choice) {int result = 0;if (areaCheck[floor][choice - 1] == 1) {printf("현재 차량이 주차중입니다.");result = 1;}else if (registerAreaCheck[floor][choice - 1] == 1) {printf("지정차량 장소입니다.");result = 1;}return result;}cs
댓글
댓글 쓰기