That is double-posting. You had to write two posts. You have to follow two threads in case someone answers. Those, who can answer, will waste their time, if they don't notice that issue has already been resolved in the other thread. You don't want to double-post.
We should say "What variable? Show exact error message."
1 2 3 4
void printDayOfBirth( intday ) // Remark: 'day' is not used in this function
{
if ( dayOfWeek == 0 ) {} // Error: What is 'dayOfWeek'?
}
If function is called with a value, then the function parameter has the value:
1 2 3 4
void printDayOfBirth( int day )
{
if ( day == 0 ) {} // OK
}
1 2 3 4 5 6
int determineDay( int snafu )
{
cin >> snafu; // You totally ignore the value that the function was called with
int answer = 42 * snafu; // You never use the answer
return 0; // Why every day is Saturday? Lucky you?
}
Use the data, return data:
1 2 3 4 5
int determineDay( int snafu )
{
int answer = 7 * snafu;
return answer;
}
I assume there is a global variable 'int dayOfWeek' in your program that you're trying to use in printDayOfBirth().
That doesn't work because you declare a new variable with the same name (dayOfWeek) in determineDay().
The stuff you write to dayOfWeek inside determineDay() will not end up in the global variable also named dayOfWeek.
Again, following my assumption that there is a global variable named dayOfWeek,
your code will work if you remove the 'int' in front of int dayOfWeek in determineDay().
That way you access the global variable instead of the local variable with the same name.
However, the solution keskiverto provided is better, because it doesn't involve global variables, which is always a good thing.