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?
2 ответов
+ 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
0
case value can be single character or letter also