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 whe

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 ;
}

Error checking switch-case (char-int check) #2994

Following program may compile and link well but still it may not serve the de

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

Code error finding #5302

( As In Exam - CBSE12A-2017 )

Rewrite the following C++ code after removing any/all syntactical errors wit

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;
}

01C-2015 #6008

( As In Exam - CBSE12D-2017 )

Rewrite the following C++ code after removing any/all syntactical errors wit

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;
}

Code Sheets:7  Solved Problems:4 
×
Introductory Sessions Beginning to Program Tokens Keyword and Identifiers Data Types Variables and Constants Operators Simple User Input Building Expressions and Formulas Simple Real World Problems Simple If and If Else Multiple-Nested-Ladder of If Else Switch case selection Simple Loops Tricks in Loops - break continue scope Loop Applications - Handling numerals Series printing loops Nested Loops Pattern printing loops Number Varieties and Crunches String Handling (Null Terminated) Strings - string class type Functions (Built-in) Functions - user defined Functions Reference Passing/Returning Arrays Concepts and 1-D Arrays Array Data Management Two dimensional arrays and Matrices Structures Basics Structures passing/returning Display Using IO Manipulation Display Using C Formatting Tricks User Defined Data Types Enumerated Types Preprocessor Directives And Macros Exception Handling Programming Paradigms and OOPs Advantages Abstraction and Encapsulation Polymorphism Inheritance Function Overloading Concepts Function Overloading Varieties Function Overloading Special Cases Defining Classes Creating and Using Class Objects Class Members Accessibility Class Function Types Inline Functions Constant Functions Nesting of Functions Class Members Scope Resolution Static Members in a Class Array of Objects Constructor Concepts Default Constructor Parameterized Constructor Copy Constructor Constructor Overloading Destructors Inheritance Fundamentals Public Derivations Private and Protected Derivations Multiple Inheritance Mult-Level Inheritance Class Nesting Data File Concepts Handling Text Files Handling Binary Files Pointer Concepts Pointer and Arrays Pointers and Functions Object Pointers This Pointer Linked Lists Stacks Queues


Back