Topic Wise Solved Problems Question – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  


Shop
siteicon
CPP All :Topicwise Exam Questions: switch-case-selection siteicon
01C-2015 2

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 integer";
  cin>>N;
  switch(N%2)
  case 0 cout<<"Even"; Break;
  case 1 cout<<"Odd" ; Break;
}
CBSE12D-2017

Code error finding 2

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>>CH;
switch(CH)
case ‘A’ cout<<"Ant"; Break;
case ‘B’ cout<<"Bear" ; Break;
}
CBSE12A-2017