0

Is it necessary to use the court function with a switch statement? And does the case value always have to be a number? or can it be a letter or word?

30th Sep 2016, 7:11 PM
Danielle Gaston
Danielle Gaston - avatar
2 Answers
+ 1
i think you mean cout function with a switch statement. cout statement in a switch is helpfull in finding out which case is executed during run time and if our desired result is present in any of the case for example if i want 5 as my desired output and i ran a code to increment the value of a variable (suppose x) and waiting for my output using switch so if my case (let 4th case) have a if statement saying if(x==5) then for knowing that my desired output is found i must have a cout line saying cout<<"your desired output is found in 4th case"; so it will help me to understand that my code is running and giving logical outputs and also help me to enhance my code later on if needed . i hope this helped if you don't understand anything do contact me thank you
13th Jun 2017, 12:11 PM
Gaurav K
Gaurav K - avatar
0
case value can be single character or letter also
30th Sep 2016, 8:13 PM
Nilay Solanki
Nilay Solanki - avatar