<div><br></div> <div>typedef struct { // 재고 대장: 현재 보유하고 있는 Video 정보 저장 </div> <div><span style="white-space:pre;"> </span>char title[MAX_CHAR];</div> <div><span style="white-space:pre;"> </span>int qty; // 수량</div> <div>} VideoInfo;</div> <div><br></div> <div>void printAllVideo(VideoInfo videoList[], int videoCount)</div> <div>{</div> <div><span style="white-space:pre;"> </span>int i;</div> <div><br></div> <div><span style="white-space:pre;"> </span>printf("Video제목\t수량\n");</div> <div><span style="white-space:pre;"> </span>printf("-------------------------\n");</div> <div><span style="white-space:pre;"> </span>for (i = 0; i < videoCount; i++)</div> <div><span style="white-space:pre;"> </span>printf("%s\t%d\n", videoList[i].title, videoList[i].qty);</div> <div>}</div> <div><br></div> <div>void purchaseVideo(VideoInfo videoList[], int *videoCountPtr, char *title, int qty)</div> <div>{</div> <div><span style="white-space:pre;"> </span>*videoList[*videoCountPtr].title = *title;</div> <div><span style="white-space:pre;"> </span>videoList[*videoCountPtr].qty = qty;</div> <div><span style="white-space:pre;"> </span>*videoCountPtr += 1;</div> <div>}</div> <div><br></div> <div><br></div> <div>int main(void)</div> <div>{</div> <div><span style="white-space:pre;"> </span>int videoCount = 5;</div> <div><span style="white-space:pre;"> </span>VideoInfo videoList[MAX_VIDEO] = { {"BeforeSunrise", 1}, {"BeforeSunset", 3}, {"BeforeMidnight", 5}, {"Casablanca", 7}, {"EdgeOfTomorrow", 9} };</div> <div><span style="white-space:pre;"> </span>int rentCount = 0; // 현재 대출 건수는 0임</div> <div><span style="white-space:pre;"> </span>RentInfo rentList[MAX_CUST];</div> <div><br></div> <div><br></div> <div><span style="white-space:pre;"> </span>int choice;</div> <div><span style="white-space:pre;"> </span>int indexSearched;</div> <div><span style="white-space:pre;"> </span>char title[MAX_CHAR];</div> <div><span style="white-space:pre;"> </span>int custId, qty;</div> <div><br></div> <div><br></div> <div><span style="white-space:pre;"> </span>printf("1(All Video 출력), 2(구입), 3(검색), 4(대여), 5(All 대여정보 출력), 6(종료): ");</div> <div><span style="white-space:pre;"> </span>scanf("%d", &choice);</div> <div><br></div> <div><span style="white-space:pre;"> </span>while (choice != 6) {</div> <div><span style="white-space:pre;"> </span>switch (choice) {</div> <div><span style="white-space:pre;"> </span>case 1:</div> <div><span style="white-space:pre;"> </span>printAllVideo(videoList, videoCount);</div> <div><span style="white-space:pre;"> </span>break;</div> <div><span style="white-space:pre;"> </span>case 2:</div> <div><span style="white-space:pre;"> </span>printf("Enter video 제목: ");</div> <div><span style="white-space:pre;"> </span>scanf("%s", title);</div> <div><span style="white-space:pre;"> </span>printf("Enter video 수량: ");</div> <div><span style="white-space:pre;"> </span>scanf("%d", &qty);</div> <div><span style="white-space:pre;"> </span>purchaseVideo(videoList, &videoCount, title, qty);</div> <div><span style="white-space:pre;"> </span>break;</div> <div><span style="white-space:pre;"> </span>}</div> <div><span style="white-space:pre;"> </span>printf("1(All Video 출력), 2(구입), 3(검색), 4(대여), 5(All 대여정보 출력), 6(종료): ");</div> <div><span style="white-space:pre;"> </span>scanf("%d", &choice);</div> <div><span style="white-space:pre;"> </span>}</div> <div>}</div> <div><br></div> <div><br></div> <div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">질문 >>></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2"><br></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2"><br></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">1. purchaseVideo함수 안에서</font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"> <div style="margin:0px;padding:0px;"><font size="2">*videoList[*videoCountPtr].title = *title;</font></div> <div style="margin:0px;padding:0px;"><font size="2">videoList[*videoCountPtr].qty = qty;</font></div> <div style="margin:0px;padding:0px;"><font size="2">*videoCountPtr += 1;</font></div></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2"><br></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">라고 적었는데 title은 videoList앞에 포인터 형식을 넣지 않으면 빨간줄이 뜨고</font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">qty는 포인터 형식을 넣지 않아도 괜찮습니다. </font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">이건 왜 이러는 건가요? ㅠㅠㅠㅠ</font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2"><br></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2"><br></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2"><br></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">2. purchaseVideo함수를 위처럼 정의하고 난 뒤 빌드업을 하면</font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">디버그 창에서 2(구입)을 선택 후 제목과 수량을 입력받는데</font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2"><br></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">예를 들어 입력을 </font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">제목: BeginAgain</font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">수량: 10</font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">이라고 입력한 후 AllVideo 출력을 다시 하면</font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">(이미 저장되어 있는 것들은 다 정상적으로 뜨는데) </font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">B 10 이라고 뜹니다. 이건 왜 이러는 걸까요??ㅠㅠㅠ</font></div></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2"><br></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2"><br></font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">식이 너무 길어서 보기 귀찮으실 수도 있지만 한번만 도와주시면 감사하겠습니다 ㅠㅠ</font></div> <div style="margin:0px;padding:0px;font-family:'Helvetica Neue', 'Apple SD Gothic Neo', '나눔고딕', NanumGothic, '맑은 고딕', 'Malgun Gothic', '돋움', Dotum, sans-serif;"><font size="2">물어볼 곳이 없어서요 ㅠㅠ</font></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.