首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

这是g++的有关问题吗?还是…

2012-02-09 
这是g++的问题吗?还是……我在suse11.2下的g++4.4.1运行C++程序,出现以下错误,是什么原因??怎么解决????test

这是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

C/C++ code
#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;}


[解决办法]
你缺了这几个函数的头文件...
[解决办法]
楼主,你这是学C++呢,还是学C啊?
[解决办法]
#include <stdio.h>
#include <mem.h>
[解决办法]
C和C++搅合一起了

热点排行