Write the correct output (C++) #include using namespace std; int main(){     int num=1;    switch(num){    case 1: cout<<"1";    case 2: cout<<"2";    case 3: cout<<"3";    case 4: cout<<"4";    case 5: cout<<"5";    default: cout<<"invalid";    }   return 0; }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter4: Making Decisions
Section: Chapter Questions
Problem 13RQ
icon
Related questions
Question

Write the correct output (C++)

#include<iostream>
using namespace std;
int main(){
    int num=1;
   switch(num){
   case 1: cout<<"1";
   case 2: cout<<"2";
   case 3: cout<<"3";
   case 4: cout<<"4";
   case 5: cout<<"5";
   default: cout<<"invalid";
   }
  return 0;
}

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,