#include <iostream>
#include <string>
using namespace std;

class Book {
public:
    string title;
    string author;

    Book(string t = "", string a = "") {
        title = t;
        author = a;
    }

    void printInfo() {
        cout << "title: " << title << ", author: " << author << endl;
    }
};

int main() {
    Book library[5] = {
        Book("대황유", "호날두"),
        Book("맨유", "박지성"),
        Book("대맨유", "브페"),
        Book("맨체스터", "루니"),
        Book("유나이티드", "베스트")
    };

    string searchTitle;
    cin >> searchTitle;

    bool found = false;
    for (int i = 0; i < 5; i++) {
        if (library[i].title == searchTitle) {
            cout << "저자: " << library[i].author << endl;
            found = true;
            break;
        }
    }

    if (searchTitle =! found) {
        cout << "찾을 수 없음" << endl;
    }

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: