2_Answers_Structures_12

2_Answers_Structures_12 - CIS 15BG Answers Chapter 12...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CIS 15BG Answers Chapter 12 STRUCTURES NOTE: Questions 1 to 6 are related. Two structures are to be used. The first structure consists of two fields. The first field is qty (for quantity, an integer), and the second field is book (of type BOOK ). The name of the type is to be BOOK_ORDER . The BOOK structure has four fields: title (string of size 51), author (string of size 81), price (float), and year (integer). 1. Define a type for each of the structures described above. typedef struct { char title[51]; char author[81]; float price; int year; }BOOK_ORDER; typedef struct { int qty; BOOK book; }BOOK_ORDER; 2. Define order , a variable of type BOOK_ORDER , then initialize it. Let’s say an instructor wants to order 40 books: Beginning with C by Ron House, 59.99, 1994. BOOK_ORDER order = {40, {"Beginning with C", "Ron House", 59.99, 1994}}; 3. Write a function that receives a structure of type BOOK_ORDER and prints it to the screen. void printOrder ( BOOK_ORDER order )
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/02/2011 for the course CIS 15BG taught by Professor Staff during the Winter '10 term at DeAnza College.

Page1 / 3

2_Answers_Structures_12 - CIS 15BG Answers Chapter 12...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online