I have a c++ program whose main function looks something like this:
if(a.size == 2) {
if(s1) {
f1(a[0], a[1], "string1");
}
else{
f1(a[0], a[1], "string2");
}
}
if(a.size == 1) {
if(s1) {
f1(a[0], "string1");
}
else{
f1(a[0], "string2");
}
}
else {
if(s1) {
f1("string1");
}
else{
f1("string2");
}
}
...
...
...
...
where a
and s1
are received from commandline options.
It has many commandline options and many layers of if...else..
structures and looks even messier.
Is there a way to improve?