[Dev-C++] use of `count' is ambiguous
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Bob T. <rte...@am...> - 2004-08-18 23:03:42
|
Line 14 C:\Developer\DEV-C++\C++ Dev\Program8.cpp use of `count' is
ambiguous
I am working through a beginners book on C++ and below is code that will =
not
compile in DEV C++ 4.9 it gives me the error above. What's wrong here?
It will compile in Visual Studio 7.0.
=20
#include <iostream>
using namespace std;
=20
void func1();
void func2();
=20
int count; // this is a global variable
=20
int main()
=20
{
int i; // this is a local variable
for(i=3D0; i<10; i++) {
count =3D i * 2;
func1();
}
return 0;
}
=20
void func1()
{
cout << "count: " << count; // access global count
cout << '\n'; // output a newline
func2();
}
=20
void func2()
{
int count; // this is a local variable
for(count=3D0; count<3; count++) cout << '.';
}
|