P
pauldepstein
How do I count the number of times I tested a program?
My first attempt was this:
#include <iostream>
using namespace std;
int main()
{
static int times_tested = 0;
times_tested ++;
cout << times_tested;
system("PAUSE"); // Yeah, I know the experts don't like "PAUSE"
but blame my // teacher
}
Obviously, it doesn't work -- the static times_tested retains its value
outside the loop but, of course, it doesn't remember the value after
the program has finished completely.
It seems that I need a sort of extremely-static designation which not
only retains the value after the loop but even after the program has
run.
Is there a way of doing this?
Thank you,
Paul Epstein
My first attempt was this:
#include <iostream>
using namespace std;
int main()
{
static int times_tested = 0;
times_tested ++;
cout << times_tested;
system("PAUSE"); // Yeah, I know the experts don't like "PAUSE"
but blame my // teacher
}
Obviously, it doesn't work -- the static times_tested retains its value
outside the loop but, of course, it doesn't remember the value after
the program has finished completely.
It seems that I need a sort of extremely-static designation which not
only retains the value after the loop but even after the program has
run.
Is there a way of doing this?
Thank you,
Paul Epstein