Is there another way to write this code with the same output?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/7368007/can-this-c-source-code-be-written-any-other-way-if-so-how">Can this C++ source code be written any other way? If so how?</a>  </p>
</blockquote>



<p>I haven't seen a code written like this. I'm new to C++ and am trying to learn new/more things about it. The way I am writting code now does not look anything like this and I don't understand everything going on in the code. So I was looking for help in understading and more importantly if this code can be written any other way? Maybe easier to understand for beginners or something along those lines. Thanks for all the help.</p>

<p>Here is the code:</p>

<pre><code> #include "stdafx.h"
 #include &lt;iostream&gt;

/*A prgram that accpects input of an employees' base salaries and years of service.
Then it also calculates their bonus based on the years of service.

     - 20 or more years of service, bonus = salary * 0.1

     - 10 or more years of service, bonus = salary * 0.05

     - 5 or more years of service, bonus = salary * 0.025

Also the program should let the user to enter data until they want to stop. */

using namespace std;


int main() {

int iSalary;

int iService;

float fBonus;

int counter = 1;

bool okcontinue = true;

char idontchar; 

while (okcontinue) {

    cout &lt;&lt; "You are employee #" &lt;&lt; counter &lt;&lt; " to use this.\n";

    cout &lt;&lt; "Enter your base salary: \n";

    cin &gt;&gt; iSalary;

    cout &lt;&lt; "Enter total # of years serviced: \n";

    cin &gt;&gt; iService;

    if (iService &gt;= 20) fBonus = iSalary * 0.1;

    if ((iService &lt; 20) &amp;&amp; (iService &gt;= 10)) fBonus = iSalary * 0.05;

    if ((iService &lt; 10) &amp;&amp; (iService &gt;= 5)) fBonus = iSalary * 0.025;

    cout &lt;&lt; "Your bonus is: " &lt;&lt; fBonus &lt;&lt; ". Enter 'e' to exit or 'c' to continue.\n";

    cin &gt;&gt; idontchar;

    if (idontchar == 'e') return 0;

    counter++;

    system("CLS");

    }

}
</code></pre>
