Compile Error

/in/foo.cc: In function 'int find_max()':
/in/foo.cc:2:10: error: 'a' was not declared in this scope
  int ans=a[1];
          ^
/in/foo.cc:3:16: error: 'n' was not declared in this scope
  for(int i=2;i<n+1;i++)//遍历寻找最大值
                ^
/in/foo.cc:4:19: error: 'max' was not declared in this scope
   ans=max(ans,a[i]);
                   ^
/in/foo.cc: In function 'void print(int)':
/in/foo.cc:8:17: error: 'n' was not declared in this scope
  for(int i=1;i<=n;i++)
                 ^
/in/foo.cc:9:6: error: 'a' was not declared in this scope
   if(a[i]==zd) cout<<"No."<<i<<endl;//输出内存最多的箱子
      ^
/in/foo.cc:9:16: error: 'cout' was not declared in this scope
   if(a[i]==zd) cout<<"No."<<i<<endl;//输出内存最多的箱子
                ^~~~
/in/foo.cc:9:32: error: 'endl' was not declared in this scope
   if(a[i]==zd) cout<<"No."<<i<<endl;//输出内存最多的箱子
                                ^~~~
/in/foo.cc:10:5: error: 'a' was not declared in this scope
  if(a[n+1]>0) //判断是否有多余的
     ^
/in/foo.cc:10:7: error: 'n' was not declared in this scope
  if(a[n+1]>0) //判断是否有多余的
       ^
/in/foo.cc:11:3: error: 'cout' was not declared in this scope
   cout<<"Others:"<<a[n+1];//输出装不下的
   ^~~~

信息

递交者
类型
递交
题目
P1146 对号入箱
语言
C++
递交时间
2024-07-04 16:04:27
评测时间
2024-07-04 16:04:27
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes