C++ struct Assigning data values to a structure's members

Description

C++ struct Assigning data values to a structure's members

// A program that defines and populates a structure
#include <iostream>
using namespace std;
int main()//from  w  w  w  . ja v  a2s.c om
{
   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;
}



PreviousNext

Related