C++ Struct

Struct

  • Declare
    struct BOOK
    {
    char Title[80];
    char Author[80];
    char Publisher[80];
    int Year;
    };
  • Initialize
    BOOK Novel =
    {
    "Paneless Programming",
    "I.C. Fingers",
    "Gutter Press",
    1981
    };
  • Access
    cout << Novel.Title;
    Nove.Year = 1988;
    // Via pointer
    RECT aRect = { 0,0,100,100};
    RECT* pRect = &aRect;
    (*pRect).Top += 10;
    // Equivalent
    pRect->Top += 10;
  • window.h
    • Defines struct RECT{int left; int top; int right; int bottom};
    • Helper functions for RECT
      • InflateRect()
      • EqualRect()
  • MFC
    • Defines a class called CRect
    • Extensive functions to manipulate rectangular
This entry was posted in cpp. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.