Page 103 - C++
P. 103
void main()
{
int A[]= {1, 2, 3}, B[] = {20, 30, 40, 50}, C[]= {100, 200};
ChangetheContent(A,3);
ChangetheContent(B,4);
ChangetheContent(C,2);
for(int L=0; L<3; L++) cout<<A[L]<<’#’;
cout<<endl;
for(int L=0; L<4; L++) cout<<B[L]<<’#’;
cout<<endl;
for(int L=0; L<2; L++) cout<<C[L]<<’#’;
cout<<endl;
}
(e) Give the output of the following program (Assuming that all required header files are included in the
program) [2]
void main()
{
char a[]= “Exam-2011 AheAd”; int i;
for(i=0; a[i]!= ‘\0’;i++)
{
if(a[i]>= 97 && a[i]<=122) a[i] --;
else
if(a[i]>= ‘0’ && a[i]<= ‘9’) a[i] = a[i -1];
else
if(a[i]>= ‘A’ && a[i]<= ‘Z’) a[i]+ = 32; else
a[i]= ‘#’;
}
puts(a);
}
(f) Study the following program and select the possible output from it: [2]
#include<iostream.h>
#include<stdlib.h>
const int LIMIT = 4;
void main()
{
randomize(); int Points;
Points= 100 + random(LIMIT);