I've been working with VB.NET for years and I luv the language. Now dispersing myself into C++ I'm having a tough time to grasp the logics of C++.
Kindly tell me any workaround. Thanks a lot !
I've been working with VB.NET for years and I luv the language. Now dispersing myself into C++ I'm having a tough time to grasp the logics of C++.
Kindly tell me any workaround. Thanks a lot !
That is quite an unclear question, but you are probably asking why you cannot do this:
switch(mynumber) { //assuming an int here
case 1:
printf("Something.");
break;
case 2 || 3:
printf("Something else.");
break;
}
This will not work as you expected: the || operator in C++ will actually do 2 || 3
, evaluating to 1
. Instead, you can replicate your case statements:
switch(mynumber) {
case 1:
printf("Something.");
break;
case 2:
case 3:
printf("Something else.");
break;
}
Looks like VB.NET supports expression in case statements while C++ does not.