+ 3
What data type can a case have?
When I was testing string around, I made a switch statement and declared that a case would be "Apple", but it resulted in an error; so can a case be a different data type than int?
6 Answers
+ 7
Yes, you can use string in switch, you can post your code, then we help you easier
0
C++ doesn't support switches on arrays.
http://en.cppreference.com/w/cpp/language/switch
0
I am not good in math but I am doing my best on my own cheer me on. Love everyone. Who cares if I say this haha.đ
0
https://code.sololearn.com/cKB9qG2oSNCC/?ref=app
You can use string in switch . In the above code I used character in switch just check if it helps .
0
You can use a enum in switch, and the compiler tell you if one enum is not defined in your switch. Example:
enum probe {one, two, three};
switch (enum probe) {
case one:
case two:
case three:
}
Its a very simple example. I hope to help you.
- 1
@Felicia I am sorry about your math skills and I care that you said it. However, your post has nothing to do with this question so needs to be deleted. Please avoid off topic posts in the future.
https://www.sololearn.com/Discuss/321242/?ref=app