Look at the following C++ code and find the possible output(s) from the options (i) to (iv) following it. Also, write the maximum and the minimum values that can be assigned to the variable CHANGER.
Note:
● Assume all the required header files are already being included in the code.
● The function random(n) generates an integer between 0 and n‐1.
void main()
{
randomize();
int CHANGER;
CHANGER=random(3);
char CITY[][25]={'DELHI','MUMBAI','KOLKATA','CHENNAI'};
for(int I=0;I<=CHANGER;I++)
{
for(int J=0;J<=I;J++){
cout<<CITY[J];
}
cout<<endl;
}
}
(i) | (ii) |
DELHI DELHIMUMABAI DELHIMUMABAIKOLKATA |
DELHI DELHIMUMABAI DELHIMUMABAIKOLKATA DELHIMUMABAIKOLKATACHENNAI |
(iii) | (iv) |
MUMABAI MUMABAIKOLKATA MUMABAIKOLKATACHENNAI |
KOLKATA KOLKATACHENNAI |
(i)
DELHI
DELHIMUMBAI
DELHIMUMBAIKOLKATA
Minimum Value of CHANGER = 0
Maximum Value of CHANGER = 2