Hello HumanGoose,
A couple of things to start with:
Without the "mbed.h" file the program does not compile. It is always best to post the whole program or at least enough that can be compiled and testes. This includes any input file(s) that go with the program.
Using the tab key in your IDE may look fine, but when posting code here the tab key tends to be exaggerated here. Not knowing what IDE you are using it is hard to say exactly what steps to take to make changes. It may start with a tab called tools -> options or preferences after that and possibly under "Text Editor" look for the part to do with tabs. In MSVS it is "tools -> Options -> Text Editor -> C/C++ -> Tabs". For the size of the tab 4 is a good number then choose to insert spaces.
Unless it is your intention the while loop is an endless loop with no way out.
I have a feeling that you misplaced the closing } for the first if statement making the 2nd if accessible only if the 1st if statement is true. Unless that is what you want.
Should the 1st if statement be true the 1for loop would finish before the 2nd if statement is reached. It is possible that the 1st for loop could be bypassed if the value of "Voltage" is less than (0)zero.
Another part I noticed:
15 16 17 18 19 20
|
for (int i = 0; i <= Voltage; i++)
{
printf("^");
i++;
}
| |
Line 19 adds 1 to "i" before the last part of the for loop add 1. This means that "i" is incremented twice. The same for "x" in the next for loop.
Tip: Since you define the loop iterator< "i", in the for loop it is a local variable to that for loop and when finished the variable is destroyed. Meaning that you can use "i" in the next for loop without any problem.
Andy