-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbooks.c
62 lines (44 loc) · 1.64 KB
/
books.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Nicole Fraidenreich
// Fun Fact: I do handstands in lots of places I visit.
#include <stdio.h>
#include <string.h>
struct Books {
char title[50];
char author[50];
int id;
};
struct Customers {
char firstname[20];
char lastname[20];
int customerid;
char bday[20];
char checkoutrecords[50];
};
int main() {
struct Books Book1;
struct Books Book2;
struct Customers Customer1;
strcpy(Customer1.firstname, "Carla");
strcpy(Customer1.lastname, "Escalante");
Customer1.customerid = 1;
strcpy(Customer1.bday, "November 14th, 2000");
strcpy(Customer1.checkoutrecords, "Borrowed one book.");
strcpy(Book1.title, "In The Time of The Butterflies");
strcpy(Book1.author, "Julia Alvarez");
Book1.id = 200;
strcpy(Book2.title, "Harry Potter and the Prisoner of Azkaban");
strcpy(Book2.author, "J.K. Rowling");
Book2.id = 201;
// output ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
printf("Book 1 Title: %s\n", Book1.title);
printf("Book 1 Author: %s\n", Book1.author);
printf("Book 1 ID: %d\n\n", Book1.id);
printf("Book 2 Title: %s\n", Book2.title);
printf("Book 2 Author: %s\n", Book2.author);
printf("Book 2 ID: %d\n\n", Book2.id);
printf("Customer 1 Name: %s %s\n", Customer1.firstname, Customer1.lastname);
printf("Customer 1 ID: %d\n", Customer1.customerid);
printf("Customer 1 Birthday: %s\n", Customer1.bday);
printf("Customer 1 Records: %s\n", Customer1.checkoutrecords);
return 0;
}