Count number of objects created in C++
<p>Need to count no. of objects created in setval. Please help. 
Source Code : <a href="https://www.dropbox.com/s/z6igpioidhov9oo/static.cpp" rel="nofollow">https://www.dropbox.com/s/z6igpioidhov9oo/static.cpp</a></p>

<pre><code>#include&lt;iostream&gt;
#include&lt;conio.h&gt;
using namespace std;

class student
{
    static int count;
protected:
    char name[20];
    char course[20];
    int roll;
    float fees;
public:
    student()
    {
    }

    void setval()
    {
        count++;
        cout&lt;&lt;"\nEnter the name : ";
        cin&gt;&gt;name;
        /*cout&lt;&lt;"\nEnter the course : ";
         cin&gt;&gt;course;
         cout&lt;&lt;"\nEnter the roll : ";
         cin&gt;&gt;roll;
         */cout&lt;&lt;"\nEnter the fees : ";
        cin&gt;&gt;fees;
    }

    friend float calfeespaid(student);

    void showval()
    {
        cout&lt;&lt;"\nName = "&lt;&lt;name;
        //cout&lt;&lt;"\nCourse = "&lt;&lt;course;
        //cout&lt;&lt;"\nRoll = "&lt;&lt;roll;
        cout&lt;&lt;"\nfees = "&lt;&lt;fees;
        //cout&lt;&lt;"\nNo. of objects created : "&lt;&lt;count;
    }
};

float calfeespaid(student s)
{
    static float total;
    total=total+s.fees;
    return total;
}

main()
{
    student s[5],a;
    for(int i=0;i&lt;3;i++) 
    { 
        s[i].setval(); 
        calfeespaid(s[i]); 
    }

    for( int i=0;i&lt;3;i++) 
    { 
        //cout&lt;&lt;count; 
        s[i].showval(); 
    } 
    cout&lt;&lt;"\nTotal Fees Paid : "&lt;&lt;calfeespaid(a); 
    getch(); 
}
</code></pre>

<p>We have 3 member functions of the class student :
1. setval : To take input
2. showval : To display output
3. calfeespaid : To calculate total amount of fees paid</p>

<p>Now, my aim is to create a static int variable count which will count the number of objects created in the setval function. </p>
