Rewrite the following program after removing the syntax error(s), if any. Underline each correction.
# include <iostream.h>
void main( )
{
One = 10, Two = 20;
Callme (One;Two);
Callme (Two);
}
void Callme (int Arg1, int Arg2=20)
{
Arg1 = Arg1 + Arg2;
cout << Arg1 >> Arg2;
}
Find the output of the following program:
# include <iostream.h>
# include <ctype.h>
void main ( )
{
char Mystring [ ] = “What@OUTPUT!” ;
for (int I = 0; Mystring[I] != ‘0’; ; I++)
{
if (!isalpha(Mystring[I]))
Mystring [I] =’*’;
else if (isupper(Mystring[I]))
Mystring [I] = Mystring[I] + 1;
else
Mystring [I] = Mystring [I+1];
}
cout << Mystring;
}
Find the output of the following program:
#include<iostream.h>
void main ()
{
int A=5, B=10;
for(int I = 1;I<=2; I++)
{
cout<<”Line1=" <<A++<< "&" <<B-2<<endl;
cout<<”Line2=” <<++B<< "&" <<A+3<<endl;
}
}
. In the following program, find the correct possible output(s) from the options:
#include<stdlib.h>
#include<iostream.h>
void main ()
{
randomize() ;
char Area [][10]={ "NORTH" ,"SOUTH" ,"EAST" ,"WEST"} ;
int ToGo;
for (int I=0; I<3; I++)
{
ToGo=random(2) +1;
Cout<<Area[ToGo]<<":";
}
}
outputs:
(i) NORTH:SOUTH:EAST:
(ii) SOUTH:EAST:SOUTH:
(iii) SOUTH:EAST:WEST:
(iv) SOUTH:EAST:EAST:
Find the output of the following program : [3]
#include<iostream.h>
#include<string.h>
void main()
{
char *a[2]={”Amit”,”Sumit”};
for(int i=0;i<2;i++)
{
int l=strlen(a[i]);
for(int j=0;j<l;j++,a[i]++)
cout<<*a[i]<< “:” ;
cout<<endl;
}
Write a function in C++ which accepts a integer array and its size as an
arguments and prints the output (using nested loops) in following format :
Example : if the array is having
1 2 4 5 9
Then the output should be
1
2 2
4 4 4 4
5 5 5 5 5
9 9 9 9 9 9
Write a function in C++, which accepts an integer array and its size as arguments and swaps the elements of every even location with its following odd location.
Example: if an array of nine elements initially contains the elements as
2,4,1,6,5,7,9,23,10
then the function should rearrange the array as
4,2,6,1,7,5,23,9,10
Write a function in C++ to print the product of each row of a two dimensional integer
array passed as the argument of the function.
Example: if the two dimensional array contains
|
20
|
40
|
10
|
|
40
|
50
|
30
|
|
60
|
30
|
20
|
|
40
|
20
|
30
|
Then the output should appear as :
Product of Row 1= 8000
Product of Row 2= 6000
Product of Row 3= 3600
Product of Row 4= 2400