Can I create a chart to define a variable
depends
You should give far more information what you mean exactly to get meaningful answers.
Can I create a chart to define a variable
Since "chart" is not a C or C++ term, no. But, as rob says, explain what you want to do, and there probably is some C or C++ construct that does what you want.
I would like to create some cases and then if the condions are applied so then he choose one case and never change it anymore
What's that got to do with charts?
Please re-read reply #1