Hi!
I'm making a program relying on switches with many cases.
Is there a way to autocomplete a switch?
Like I press a button and I automatically get a new line of 'case' with autocompleted number and break?
Thanks
It depends on your IDE if you can do that, but I'm not sure autocompleting the case value is something that can usually be done. Handling each number in a range like that is not even the most common situation. Often people use constant/enum names instead of magic numbers so it wouldn't really work. I guess it could be useful to be able to generate all cases for all values in an enum but I have not seen this feature so I don't know if it exist.
Usually when I'm adding a bunch of switch cases I often copy as much code as is common for all cases and then fill in the values for each case manually.
1 2
case :
break;
If you want to automatically generate all the case values you could write a program to do it but that is probably only worth it if you have a huge number of cases.
Orwell's Dev-C++ fork has the ability to add code snippets, and switch is one of the included snippets. I doubt, though Dev-C++ would do what you are looking for.,