Ok, I`ve made some changes and I think that it looks at least a little better. *sighs* But I think that there are still some major mistakes in there that I need to take care of. Can someone look at my code and give me some input please? Thanks. And thank you Hunter2 for your initial help.
Code:
#include <iostream>
using namespace std;
class doit
{
public:
doit();
doit (int a);
~doit();
void Set_it(int b);
int Retrieve();
void Print(int lne);
private:
int ingr;
static int constr;
static int destruct;
};
int doit::constr=0;
int doit::destruct=0;
void round_we_go(int X, int Y);
int main()
{
doit A(9);
doit B(-1);
int lp=0;
A.Print(__LINE__);
while(A>=B)
{
round_we_go(A, lp);
A=A-2;
lp++
}
A.Print(__LINE__);
return 0;
}
void round_we_go(int X, int Y)
{
doit thing;
static doit tracer(0);
tracer.set(tracer.get() + 1);
if(X<0)
cout << "The looping function was called " << Y << " times.";
thing.Print(__LINE__);
while(thing.get() < X.get())
{
doit thing1;
thing1.set(thing.get());
thing.set(thing.get() +1);
}
thing.Print(__LINE__);
}
doit::doit(int a)
{
ingr=a;
constr++;
}
doit::~doit()
{
destruct++;
}
void doit::Set_it(int b)
{
ingr=b;
}
int doit::Retrieve()
{
return ingr;
}
void doit::Print(lne)
{
cout << "On line " << lne << " there have been " << constr <<
<< " objects constructed and " << destruct << " destroyed.";
}