Assigning data values to a structure's members - C++ Data Type

C++ examples for Data Type:struct

Description

Assigning data values to a structure's members

Demo Code

// A program that defines and populates a structure
#include <iostream>
using namespace std;
int main()/*from   w  ww . j a  v  a  2s  .  co m*/
{
   struct
   {
      int month;
      int day;
      int year;
   } birth;
   birth.month = 12;
   birth.day = 28;
   birth.year = 1986;
   cout << birth.month << '/' << birth.day   << '/' << birth.year  << endl;
   return 0;
}

Result


Related Tutorials