another option for static variable in file handling
<p>i dont want to use static variable.....i want to use the detail written in file..how can i enter details of more than 2 employees???</p>

<pre><code>void reading(FILE *);
int main()
{
    double tax;
    char ans;
    double savings=100000;
    FILE *fp;
    int a;
    int id;
    cout&lt;&lt;"\n\n\n\n\n e - TAX return calculator !!! \n";
    cout&lt;&lt;" ...............................\n";
    cout&lt;&lt;" ...............................\n";
    a=getch();
    if(a!=0)
        system("cls");
    cout&lt;&lt;"ENTER EMPLOYEE ID : ";
    cin&gt;&gt;id;
    cout&lt;&lt;"\n\n";
    if(id==101101)
    {
        fp=fopen("employee1.txt","r");
        reading(fp);
        cout&lt;&lt;"\nDO YOU WANT TO CALCULATE THE TAX ??? (y/n) ";
        cin&gt;&gt;ans;
        if(ans=='y')
        {
             double sal=650000;
             cout&lt;&lt;"\nSAVINGS DEDUCTED : 100000\n";
             double non_sav=sal-savings;
             if(non_sav&lt;180000)
                 cout&lt;&lt;"\nNO TAX\n";
             if(non_sav&gt;180000 &amp;&amp; non_sav&lt;500000)
                cout&lt;&lt;"\nTAX = "&lt;&lt;(0.1*non_sav)&lt;500000)
             cout&lt;&lt;"\nTAX = "&lt;&lt;(0.2*non_sav)&lt;&gt;ans;
             if(ans=='y')
             {
                 double sal=800000;
                 cout&lt;&lt;"\nSAVINGS DEDUCTED : 200000\n";
                 double non_sav=sal-savings;
                 if(non_sav&lt;215000)
                     cout&lt;&lt;"\nNO TAX\n";
                 if(non_sav&gt;215000 &amp;&amp; non_sav&lt;500000)
                     cout&lt;&lt;"\nTAX = "&lt;&lt;(0.1*non_sav)&lt;500000) // missing ; - trojanfoe
                 cout&lt;&lt;"\nTAX = "&lt;&lt;(0.2*non_sav)&lt;  // trailing crap - trojanfoe
             // lots of terminating brackets missing - trojanfoe

void reading(FILE *fp)
{
    char c;
    c=getc(fp);
    while(c!=EOF)
    {
        putchar(c);
        c=getc(fp);
    }
    fclose(fp);
 }
</code></pre>
