Super curiously compiled:
1 & gt; E: \ project \ STL _ proc \ STL _ proc \ STL _ proc \ STL _ proc.cpp (86): Error C2052: "double": illegal case expression type.
Really subverted my three views. . . . The switch ("0.4") did not report an error. . After I have solved the following problem, let's see how the program handles it.
Change to:
Switch ("0.4")
{
Case "0": a = 0; Break;
Case ".":a = 9;; Break;
Default: a = 7;;
}printf("%d ",a);
After running, all go to the default branch.
Change to:
Switch ("0")
{
Case "0": a = 0; Break;
Case ".":a = 9;; Break;
Default: a = 7;;
}printf("%d ",a);
They all went to the case 0 branch.
Conclusion: switch cannot be followed by variables.