Reference reduces complex notation

 


// reference variable

//reduce complex notation

#include<iostream.h>


struct date

{

int day,month,year;

};

struct player

{

int no;

char*name;

date dt;

};

player pl[]={

{1,"Aung Aung",{2,12,1987}},

{2,"zaw zaw",{4,5,1990}},

{0}

};

//notice 0 that end player

int main(int argc, char *argv[])

{

player *p=pl;

while(p->no!=0)

{

player& pr=*p;

date& d=pr.dt;


cout<<pr.no<<"\t"<<pr.name<<"\t"<<d.day<<"/"<<d.month<<"/"<<d.year<<endl;

p++;

}

return 0;

}

Comments

Popular posts from this blog

serial to parallel test with 74c595 and pic mcu

ဆိုလာ စနစ္ရွိ BATTERY AMPACITY အား design ထုတ္တြက္ခ်က္ၿခင္း (1) watt hour ရယူၿခင္း

INTERRUPT_ON_CHANGE_18f4550