Whats wrong with this code?
Code:
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
////////////////////////////////
int StrStat(int Str1, int Str2, int Str3)
{
Str1 = (rand() % 6) + 1;
Str2 = (rand() % 6) + 1;
Str3 = (rand() % 6) + 1;
int StrTotal;
StrTotal = 0;
StrTotal = Str1 + Str2 + Str3;
while(StrTotal<8)
{
StrTotal = Str1 + Str2 + Str3;
}
return StrTotal;
}
/////////////////////////////////
int main()
{
cout<<StrStat(Str1, Str2, Str3);
return 0;
}
StrStat is a function calling for the Str1, Str2, and Str3 parameters, all of which are defined in the function. Then, the total of those are returned in the variable StrTotal, which is also the return value of the function. Well, the problem occurs when I call the function in the program. cout<<StrStat(Str1, Str2, Str); gives me undeclared identifiers. My question is why does it do that, when they are obviously declared in the function? I'm kinda new to functions you could say, because the only functions I did were add and subtract, heh, and I apparently cant even remember how to do those. Please help, thank you.