这是g++的问题吗?还是……
我在suse11.2下的g++4.4.1运行C++程序,出现以下错误,是什么原因??怎么解决????
test.cpp: In function ‘int main()’:
test.cpp:8: error: ‘stdin’ was not declared in this scope
test.cpp:8: error: ‘freopen’ was not declared in this scope
test.cpp:12: error: ‘memset’ was not declared in this scope
#include <iostream>#include <algorithm>#define max 100000using namespace std;int num[max];int main(){ freopen("in.txt","r",stdin); int n; while(cin>>n) { memset(num,0,sizeof(num)); int m=(n+1)/2; int a,answer; for(int i=0;i<n;i++) { cin>>a;num[a]++; if(num[a]>=m) answer=a; } cout<<answer<<endl; } return 0;}