Sub Book Manager1.C C语言编程实例

offer24968 3 0 c 2023-03-10 05:03:26

#include 

struct Book {
    char title[50];
    char author[50];
    char subject[100];
    int book_id;
};

void printBook(struct Book book);

int main() {

    struct Book book1, book2;        

    strcpy(book1.title, "C Programming");
    strcpy(book1.author, "Nuha Ali"); 
    strcpy(book1.subject, "C Programming Tutorial");
    book1.book_id = 6495407;

    strcpy(book2.title, "Telecom Billing");
    strcpy(book2.author, "Zara Ali");
    strcpy(book2.subject, "Telecom Billing Tutorial");
    book2.book_id = 6495700;

    printBook(book1);

    return 0;
}

void printBook(struct Book book) {
    printf( "Book title : %s\n", book.title);
    printf( "Book author : %s\n", book.author);
    printf( "Book subject : %s\n", book.subject);
    printf( "Book id : %d\n", book.book_id);
}

用户评论
请输入评论内容
评分:
暂无评论