CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 18

Threaded View

  1. #1
    Join Date
    Sep 2007
    Posts
    10

    Arrow c++ .h, .cpp question

    Hi all.. I have recently started a c++ class and I need some of your help with...

    Ive understood all thats required but below is the basic header file for which I will have to create an implementation.

    I have a stattest.cpp, .h file, & statexam.cpp and am currently working on all the functions. I will post any questions I may have. In the meantime, if you can leave me with any 'tips' to help me make sure I am on the right path will be fine.

    >>I am not asking for a full code for my program, just some helpful tips!

    Below is the given .h file :


    Code:
    #ifndef STATS_H     
    #define STATS_H
    #include <iostream>
    
    namespace stat
    {
        class statistician
        {
        public:
            // CONSTRUCTOR
            statistician( );
            // MODIFICATION MEMBER FUNCTIONS
            void next(double r);
            void reset( );
            // CONSTANT MEMBER FUNCTIONS
            int length( ) const;
            double sum( ) const;
            double mean( ) const;
            double minimum( ) const;
            double maximum( ) const;
            // FRIEND FUNCTIONS
            friend statistician operator +
                (const statistician& s1, const statistician& s2);
            friend statistician operator *
                (double scale, const statistician& s);
        private:
            int count;       
            double total;    
            double tiniest;  
            double largest;  
        };
    
        // NON-MEMBER functions 
        bool operator ==(const statistician& s1, const statistician& s2);
    }
    
    #endif
    Edit: I am currently working on the program and as soon as I have worked out different functions, I will post any questions I may have.

    Thanks!
    Last edited by GaganW18; September 23rd, 2007 at 01:03 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured