Created
November 26, 2012 13:47
-
-
Save juanfal/4148269 to your computer and use it in GitHub Desktop.
Struct sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// structsample.cpp | |
// juanfc 2011-12-08 | |
// | |
#include <iostream> | |
using namespace std; | |
// types | |
enum TMonth { JAN, FEB, MAR, APR, MAY, JUN, | |
JUL, AUG, SEP, OCT, NOV, DEC }; | |
struct TDate { | |
unsigned day; | |
TMonth month; | |
unsigned year; | |
}; | |
struct TEmployee { | |
unsigned code; | |
float salary; | |
TDate joiningDate; | |
}; | |
const TDate TODAY = {16, DEC, 2010}; | |
int main() | |
{ | |
TDate birthD, currD; | |
birthD = (TDate){19, AUG, 1960}; | |
if (birthD == currD) { | |
cout << "Compared!" << endl; | |
} | |
TEmployee empl = {101, 2000, {19, AUG, 1960}}; | |
empl.joiningDate.year++; | |
printMonth(empl.joiningDate.month); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment