Hello dracon867,
Welcome to the forum.
This is not the way to define a variable:
int (num=1,2,3,4);
. The () are causing a problem here and the comma operator is not working the way that you think. Even it this worked "num" would be equal to four, but just removing the () still caused compile errors for me. A more proper way to define a numeric variable is:
int num{};
where the empty {}s will initialize the variable to zero, 0.0 for doubles and '\0' for a "char".
It is always a good practice and programming to initialize your variables when they are defined. From the C++11 standards on the {}s or uniform initializer are the easiest way to initialize a variable. Should you need a value other than zero just put it between the {}.
Since you are new I offer a suggestion. Be consistent in the way you write your code.
An example is you write:
But later with your if statements you write:
This makes it hard to match the opening and closing brace when you go back through your code. When the {}s are in the same column and you have the proper indenting it is much easier to match the {}s or find one that is missing.
This may be just my personal preference, but I like to put the variable definitions at the beginning of a function, so I know where to find them. I might follow this something like opening a file before I start with the code of the function.
I have to test the program before I can see what it is doing. Just looking at the program I see some redundancy that should be fixed.
Hope that helps,
Andy