#include <stdio.h>
#include <string.h>
typedef struct{
int isbn;
char title[100];
char author[50];
int isBorrowed;
}Book;
int main() {
Book std[5] = {
{1001, "C언어 본색", "홍길동", 0},
{1002, "자바 프로그래밍 입문", "이순신", 1},
{1003, "자료구조와 알고리즘", "강감찬", 0},
{1004, "C++ 정복하기", "김유신", 0},
{1005, "파이썬 AI 데이터 분석", "신사임당", 1}
};
int count = 0;
char name[20];
scanf("%s", name);
for (int i = 0;i < 5;i++) {
if(strstr(std[i].title, name) != NULL)
{
if (std[i].isBorrowed == 1) {
printf("이미 대여된 책입니다");
count++;
} else {
printf("검색 결과:\n");
printf("%s\n", std[i].title);
count++;
}
}
}
if (count <= 0) {
printf("찾을 수 없습니다");
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: