Create a function that will display the value of each member
Solution
#include<iostream>
using namespace std;
struct Books { // Declaring a structure for book which contains titile, author, ID of the book.
char title[50];
char author[50];
char subject[100];
int book_id;
};
void function(struct Books book); //function Prototype
int main()
{
struct Books Book1; // Declare structure variable
Book1.title = “C++ Programming”;
Book1.author = “Bala Guruswamy”;
Book1.subject = “C++ Programming skills”;
Book1.book_id = 123450;
function(Book1); // Calling the function.
return 0;
}
void function(struct Books Book1) //function definition
{
cout<<”Title of book ::”<<Book1.title;
cout<<”Author of book ::”<<Book1.author;
cout<<”Subject ::”<<Book1.subject;
cout<<”book ID ::”<<Book1.book_id;
}
