加了using namespace std后其中count不确定
是哪儿出了问题,麻烦说的详细一点
因为使用using namespace std;
会将std
命名空间中的所有名字引入到全局作用域中,而标准库定义了一个count
函数和你定义的count
全局变量重名,因此你在main
函数里使用count
时就起来冲突,编译器不知道你指的是哪个count
。
解决方法:
nt count;
挪到main
函数里面using namespace std;
main
函数里使用::count
代替count