Hey, I'm trying to do somethign really simple but why it's not working I have no idea. Here's a section of the code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
void Hardware_test::report(int successCount[], int errorCount[], int totalFailedConnectionAttempts, int seperateDisconnects, constint numberOfOperations)
{
staticint PreviousSuccessCount[5] = { 0 };
staticint PreviousErrorCount[5] = { 0 };
::std::string errorMessage = " ";
//float acceptableFailToSuccessRatio = config_.get<float>(key_acceptableFailToSuccessRatio);
//TODO: figure out why the hell this doesn't work.
for(int i=0; i<5; i++){
if(1 < ((errorCount[i]-previousErrorCount[i])/(successCount[i]-previousSuccessCount[i]))){
if(errorChecking==true){
error_=true;
errorMessage = "The ratio of unsuccessful to successful communication attempts was too high";
}
}
}
I'm getting the following errors:
error: 'previousErrorCount' was not declared in this scope
error: 'previousSuccessCount' was not declared in this scope
error: 'errorChecking' was not declared in this scope
The Size of your arrays is 5 and you only put 1 value in there. I believe that is the problem. If not then I am dumb. If you don't want to have values in the rest then just do this.
From what I understand the way I have done it should initialise all elements within the array as 0. But I had thought of this and tried to compile it with those lines changed to
But it still wouldn't work. Plus if that had of been the issue would the error not have been that the arrays were not initialised instead of not declared?