加了using namespace std后其中count不确定
因为使用using namespace std;
会将std
命名空间中的所有名字引入到全局作用域中,而标准库定义了一个count
函数和你定义的count
全局变量重名,因此你在main
函数里使用count
时就起来冲突,编译器不知道你指的是哪个count
。
解决方法:
nt count;
挪到main
函数里面using namespace std;
main
函数里使用::count
代替count
https://en.cppreference.com/w/cpp/algorithm/count
可能是因为std里面有count这个关键字,你换一个变量名或者加个下划线。