Chapter – 2. STRUCTURES

2005 Outside Delhi:

1.d. Find the output of the following program:

#include<iostream.h>
struct Package
int Length,Breadth,Height; { };
void Occupies(Package M)
{
cout<<M.Length<<”x”<<M.Breadth<<”x”;
cout<<M.Height<<endl;
}
void main( )
{
Package P1={100,150,50},P2,P3;
++P1.Height; Occupies(P1);
P3=P1; ++P3.Lengh; P3.Breadth++;
Occupies(P3);
P2=P3; P2.Height+=50;
P2.Length--;
Occupies(P2);
}

Output:
100 x 150 x 51
101 x 151 x 51
100 x 151 x 101

2004 :

1.c. Rewrite the corrected code for the following program. Underline each correction if any.

#include<iostream.h>
structure Supergym
{
int member number;
char membername[20];
char membertype[]=”HIG”;
};
void main( )
{
Supergym person1,person2;
cin>>”Member Number: “;
cin>>person1.membhernumber;
cout<<”Member Name: “;
cin>>person1.membername; person1.member type = “MIG”; person2=person1;
cin>>”Member Number;“<<person2.membernumber;
cin<<”Member Name”<<person2.membername;
cin<<”Member Number:”<<person2.membertype;
}


Warning: include_once(../../ebooks-footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter2_d.php on line 124

Warning: include_once(): Failed opening '../../ebooks-footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter2_d.php on line 124

Warning: include_once(../../../footer19.php): Failed to open stream: No such file or directory in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter2_d.php on line 126

Warning: include_once(): Failed opening '../../../footer19.php' for inclusion (include_path='.:/opt/cpanel/ea-php83/root/usr/share/pear') in /home/cbseguess/public_html/ebooks/xii/coumputer-science/chapter2_d.php on line 126