I'm very newbie about c++
I have 3 file in the same folder ----->1. dive.h 2. dive.cpp 3. main.cpp
How to compile and run my main program "main.cpp"?
This is my information that make u understand me --------------->>
[root@localhost mycpp]# ls
dive.cpp dive.h main.cpp
[root@localhost mycpp]# cat dive.h
class Dive {
public:
Dive( float avg, float diff );
float CalcTotalPoints() const;
void Display() const;
void SetDifficulty( float diff );
void SetJudgeScore( float score );
private:
float judgeScore; //average judges score
float difficulty; //degree of difficulty
};
[root@localhost mycpp]# cat dive.cpp
#include "dive.h"
Dive:
ive( float avg, float diff )
{
SetJudgeScore( avg );
SetDifficulty( diff );
}
void Dive:
isplay() const
{
cout << " [Dive]: "
<< judgeScore << ','
<< difficulty << ','
<< CalcTotalPoints()
<< endl;
}
void Dive::SetDifficulty( float diff )
{
diffficulty = diff;
}
void Dive::SetJudgeScore ( float score )
{
judgeScore = score;
}
float Dive::CalcTotalPoints() const
{
return judgeScore * Difficulty;
}
[root@localhost mycpp]# cat main.cpp
#include "dive.h"
#include <stdio.h>
int main()
{
//Create three Dive objects.
Dive D1( 8.5, 3.0 );
Dive D2( 9.0, 2.5 );
Dive D3( 8.0, 3.3 );
// Display the Dives.
D1.Display();
D2.Display();
D3.Display();
D2.SetDifficulty( 3.0 );
// Display the Dives again.
cout << "\nChanging Dive 2\n";
D1.Display();
D2.Display();
D3.Display();
return 0;
}
[root@localhost mycpp]#
pls, recommend the best Toturial about c++ and OOP that easy to understand