C++ Programming Blog

 
 
 

Image

 #include<iostream.h>
 #include<conio.h>
 #include<stdio.h>

 struct person
    {
       char name[10];
       int code;
    };


 main( )
    {
       clrscr();

       person p1;
       person p2;

       cout<<\"\\n ********** Person-1 *********\"<<endl;

       cout<<\"\\t enter the name : \";
       gets(p1.name);

       cout<<\"\\t enter the code : \";
       cin>>p1.code;

       cout<<\"\\n ********* person-2 *********\"<<endl;

       p2=p1;

       cout<<\"\\t name : \"<<p2.name<<endl;
       cout<<\"\\t code : \"<<(p2.code<100?\"00\":\"\")<<p2.code<<endl;

       getch();
       return 0;
    }

 
 
Didn't find what you were looking for? Find more on Program to illustrate an example of structures