Top Posters
Since Sunday
New Topic  
pagnor pagnor
wrote...
Posts: 1540
6 years ago
What is the output of the following segment of code if the value 4 is input by the user when asked to enter a number?

   int num;
   int total = 0;
   cout << "Enter a number from 1 to 10: ";
   cin >> num;
   switch (num)
   {
       case 1:
       case 2:   total = 5;
       case 3:   total = 10;
       case 4:   total = total + 3;
       case 8:   total = total + 6;
       default:  total = total + 4;
   }
   cout << total << endl;

A) 28
B) 13
C) 0
D) 3
E) None of these
Textbook 
Database Concepts

Database Concepts


Edition: 7th
Authors:
Read 76 times
1 Reply
Genuine Coder
Replies
Answer verified by a subject expert
jeckojecko
wrote...
Top Poster
Posts: 690
Rep: 7 0
6 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here
1

Related Topics

pagnor Author
wrote...

6 years ago
This calls for a celebration Person Raising Both Hands in Celebration
wrote...

Yesterday
Thanks for your help!!
wrote...

2 hours ago
Good timing, thanks!
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1227 People Browsing
Related Images
  
 1586
  
 841
  
 221
Your Opinion
Who will win the 2024 president election?
Votes: 3
Closes: November 4

Previous poll results: Where do you get your textbooks?