FreeEssays.Education
Education
search Please enter something
log in/sign up
Get Your Essay

Free Essays Technology And Computing Programming Languages C And C++ B1 And Program.Struct Book

Essay About B1 And Program.Struct Book

Download paper
Essay, Pages 1 (78 words)
Latest Update: June 1, 2021
Views: 98
Download
Related Topics:
  • Technology And Computing
    • Programming Languages
      • C And C++Javascript

Declaring a Structure Globally So That It Is Available Throughout the Program
Structure1.cpp#include #include #include #include // Declaring a Structure globally so that it is available throughout the program.struct book{        char title[20];                 // Attribute of the structure book.        char author[20];         // Attribute of the structure book.        int edition;                 // Attribute of the structure book.        char isbn[14];                 // Attribute of the structure book.        char publisher[20];         // Attribute of the structure book.        float price;                 // Attribute of the structure book.};void main(){        clrscr();        cout << "Structure Called book is already created."<< endl;// Creating objects/entities from the structure. b1 & b2 are known as objects/entities.        book b1, b2;        cout << "Objects b1 & b2 of structure book are created."<< endl;// Creating objects and initialization simultaneously from the structure.        book b3 = { "Let Us C","YK",4,"81-7656-940-2","BPB",180 };// Display the contents of the b3 object. cout << "The content of object b3 is " << endl;        cout << "Title     : " << b3.title << endl;        cout << "Author    : " <<  b3.author << endl;        cout << "Edition   : " <<  b3.edition << endl;        cout << "ISBN      : " <<  b3.isbn << endl;        cout << "Publisher : " <<  b3.publisher << endl;        cout << "Price     : " <<  b3.price << endl;// copying the content of one object of structure into another object.        b1 = b3;        // Shall we repeat all the above statement for b1 object?  No, we should find another way to do the job easily.        // .......................Thinking...............                        //...........................ok..................        // Now pass the whole object into a function as an argument.// Declaring a function having structure as an argument.        void display(struct book);// call display function.        cout << "The content of object b1 is ... " << endl;        display(b1);// Accept the information from the user and store it into b2 object.        cout << "Enter information for b2 object." << endl;

Get Your Essay

Cite this page

B1 And Program.Struct Book. (June 1, 2021). Retrieved from https://www.freeessays.education/b1-and-program-struct-book-essay/

Search for Free Essay On Any Topic
Search database
search Please enter something
Save time on writing
Hire a pro to write you an essay!
Get Your Essay
FreeEssays.Education
Education
© 2016 - 2025 FreeEssays.Education
[email protected]
COMPANY
LEGAL
Payment
visa mc amex discover
FreeEssays.Education uses cookies. By continuing you agree to our cookie policy
Copying content
is not allowed on this website
Get your own text
Get Your Essay
Give us your email and we'll send you the essay you need
By clicking Send Me The Sample you agree to the terms and conditions of our service. We'll not send you spam or irrelevant messages
We can send you a Sample
Or You Can get your own text
Get Your Essay
Give us your email and we'll send you the essay you need
By clicking Send Me The Sample you agree to the terms and conditions of our service. We'll not send you spam or irrelevant messages
Thanks! Your sample has been sent.
Please check your inbox to verify your email
Get Your Essay