Ans:
#include<iostream.h>
#include<stdio.h>
void main( )
{
struct movie
{
char movie_name[20];
char movie_type;
int ticket_cost;
//Initialization of variables inside a structure is not allowed.
}
MOVIE;
gets(MOVIE.movie_name);
cin>>MOVIE.movie_type;
//A single character cannot be read using gets
}
2005 Delhi:
1.d. Find the output of the following program:
#include<iostream.h>
struct MyBox
{
int Length,Breadth,Height;
};
void Dimension(MyBox M)
{
cout<<M.Length<<”x”<<M.Breadth<<”x”;
cout<<M.Height<<endl;
}
void main( )
{
MyBox B1={10,15,5},B2,B3;
++B1.Height;
Dimension(B1);
B3=B1;
++B3.Length;
B3.Breadth++;
Dimension(B3);
B2=B3; B2.
Height+=5;
B2.Length--;
Dimension(B2);
}
Output:
10 x 15 x 6
11 x 16 x 6
10 x 16 x 11