Login


Lost your password?

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


Shop
CPP All : Switch case selection
Concept Learning Code Sheets
Finding the day by days of week number – switch case #1963 

User gives the day number and the program outputs the day name for five days and holiday for sat. and sun.

Finding the day by days of week number – if else #1968 

User gives the day number and the program outputs the day name for five days and holiday for sat. and sun. using the if else logic instead of switch case

Checking if character entered is a vowel – switch-case #1973 

Entering a character from console and then checking if entered character is a vowel or something else.

Finding quarter of the year based on month – switch case #1975 

User inputs the month code from 1 to 12 and the output indicates the quarter of the month which it falls in.

Menu creation using switch-case #1978 

Creating a menu using switch case and run appropriate code piece based on menu selection.

Finding odd even number using a switch case #2056 

Finding if the given number is odd or even using a switch-case construct.

Calculator using the switch case #2059 

A program that works like a calculator for two input numbers and works for most arithmetic operations like addition, subtraction, multiplication, division etc.

Solved Problems
Switch case with fall through example. #2371 

Write the output of the following code based on the switch-case selection when the user input is B, L, D or S. Assume inclusion of appropriate header files.

int main ( )
{ 
  char m;
  cout<<"Enter meal type (B/L/D): ";
  cin>>m;
  switch (m)
  {
    case 'B': 
    case 'b':cout<<"Have some thing. ";
    case 'L':
    case 'l':cout<<"Come to Dining Table.";break;
    case 'D':
    case 'd':cout<<"Let's go outside."; break;
    default: cout <<"Error in input";
  }
  return 0 ;
}
Write the output of the following code based on the switch-case selection when the user in ...
Error checking switch-case (char-int check) #2994 

Following program may compile and link well but still it may not serve the desired purpose. Find the error.

Following program may compile and link well but still it may not serve the desired purpose ...
Code error finding #5302 

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;
}
Rewrite the following C++ code after removing any/all syntactical errors with each correc ...
01C-2015 #6008 

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;
}
Rewrite the following C++ code after removing any/all syntactical errors with each correc ...
Exam Questions
CBSE12A-2017-01C  Code error finding #5302 

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;
}
Rewrite the following C++ code after removing any/all syntactical errors with each correc ...
CBSE12D-2017-01C  01C-2015 #6008 

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;
}
Rewrite the following C++ code after removing any/all syntactical errors with each correc ...

Code Sheets:7  Solved Problems:4  Exam Questions:2 
Back