hi, i've been learning c++ for a very short time from Herbert Schilts book. i wrote the program from the book, but it won't compile. it can't be too hard, but i am completly new to the world of programming
#include <iostream>
usingnamespace std;
void f1();
void f2();
int count;
int main()
{
int i;
for(i=0;i<10;i++){
count = i*2;//problem here
f1();
}
return 0;
}
void f1()
{
cout << "count" << count;
cout << "\n";
f2();
}
void f2()
{
int count;
for(count=0;count<3;count++) cout << ".";
}
i get a compile error(using code::blocks) that count is undeclared, in both f1() and f2(). i thought that the use of global variables (though not often) would prevent this error, as they can be assessed throughout the entire code.
what appears to be wrong? thanks for any simple help.