2013-09-16, 12:52 AM
(This post was last modified: 2013-09-16, 12:56 AM by MariettaRC.)
Ahh, that helps a lot, thanks! I still have another problem, though...
I've got errors stating that value is an undeclared variable, and I can see why now. But isn't there a way for the program to find it initialized outside of the function or would I have to declare these variables within the function?
So basically, as an example;
EDIT: I ask this because the basic format of our program has the variable declaration inside the main function, and it sort of feels like I'll have all of my declarations within my declared functions.
I've got errors stating that value is an undeclared variable, and I can see why now. But isn't there a way for the program to find it initialized outside of the function or would I have to declare these variables within the function?
So basically, as an example;
Code:
int InputCount (ifstream &inF)
{
int valueCount = 0; //Initialize the value count at 0.
while (inF >> value)
{
valueCount += 1; //Increment value count.
}
return valueCount;
}
int main()
{
float value;
-insert rest of code here-
}EDIT: I ask this because the basic format of our program has the variable declaration inside the main function, and it sort of feels like I'll have all of my declarations within my declared functions.

