Advertisements
Advertisements
प्रश्न
Rewrite the following C++ code after removing any/all syntactical errors with each correction underlined.
Note: Assume all required header files are already being included in the program.
void main()
{
cout<<"Enter an Alphabet:" ;
cin>>CB ;
switch(CH)
case 'A' · cout<<"Ant"; Break ;
case 'B' · cout<<"Bear"; Break;
}
उत्तर
void main()
{
cout<<"Enter an Alphabate:";
cin>>CH;
switch(CH)
{
case :'A' cout<<"Ant"; Break;
case :'B' cout<<"Bear: ; Break;
}
}
APPEARS IN
संबंधित प्रश्न
Write the type of C++ token (keywords) and the User-defined identifier from the following.
1) else
2) Long
3) 4Queue
4) _count
Rewrite the following C++ code after removing any/all syntactical error with each correction underline
Note: Assume all required header files are already included in the program.
Typedef Count(int);
void main()
(
Count C;
cout<<"Enter the count:";
cin>>C;
for (K = 1 ; K<=C;K++)
cout<< C "*" K <<end1;
}
Write the type of C++ tokens (keywords and user-defined identifiers) from the following:
1) new
2) While
3) case
4) Num_2
Find the correct identifiers out of the following, which can be used for naming Variable, Constants or Functions in a C++ program.
For, while, INT, NeW, delete, lstName, Add+Subtract, namel
Observe the following C++ code very carefully and rewrite it after removing any/all syntactical errors with each correction underlined.
Note: Assume all required header files are already being included in the program
#Define float MaxSpeed=60.5;
void main()
{
int MySpeed
char Alert='N';
cin>>MySpeed;
if MySpeed>MaxSpeed
Alert='Y';
cout<<A1ert<<endline;
}
Write the output of the following C++ program code :
Note: Assume all required header files are already being included in the program.
void Location(int &X,int Y=4)
{
Y+=2;
X+=Y;
}
void main()
{
int PX=l0,PY=2;
Location(PY);
cout<<PX<<","<<PY<<endl;
Location(PX,PY);
cout<<PX<<", "<<PY<<endl;
}
Write the output of the following C++ program code:
Note: Assume all required header files are already being included in the program.
class Eval
{
char Level;
int Point;
public:
Eval(){Level='E'; Point=O;}
void Sink(int L)
{
Level~=L;
}
void Float(int L)
{
Level+=L;
Point++;
}
void Show()
{
cout<<Level<<"#"<<Point<<endl;
}
};
void main ()
{
Eval E;
E.Sink(3);
E.Show();
E.Float(7);
E.Show();
E.Sink(2);
E.Show();
}
Study the following program and select 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 VAL
Note:
-Assume all required header files are already being included in the program.
- random(n) function generates all integer 6, and n-1.
void main ()
{
randomize();
int VAL;
VAL=random(3)+2;
char GUESS[] ="ABCDEFGHIJK";
for(int I = 1, I = 1;I <= VAL; I++)
{
for (int J=VAL; J<= 7; J++)
cout<<GUESS[J];
cout<<endl;
}
}
1)
2)
3)
4)