Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
77009 王郡翊 最大值与最小值的差 C++ Compile Error 0 MS 0 KB 360 2024-06-08 09:19:35

Tests(0/0):


Code:

#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<iomanip> using namespace std; int main() { int a[10] = {1, 2, 3, 4, 5, 6, 78}; int mxx = 0; int ndd = 10000 for (int i = 0; i <= 7; i++) { if (a[i] > mxx) { mxx=[i]; } if (a[i] < mxx) { ndd=a[i]; } } }cout<<mxx-ndd; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:12:2: error: expected ',' or ';' before 'for'
  for (int i = 0; i <= 7; i++) {
  ^
Main.cc:12:18: error: 'i' was not declared in this scope
  for (int i = 0; i <= 7; i++) {
                  ^
Main.cc:9:6: warning: unused variable 'a' [-Wunused-variable]
  int a[10] = {1, 2, 3, 4, 5, 6, 78};
      ^
Main.cc:10:6: warning: unused variable 'mxx' [-Wunused-variable]
  int mxx = 0;
      ^
Main.cc:11:6: warning: unused variable 'ndd' [-Wunused-variable]
  int ndd = 10000
      ^
Main.cc: At global scope:
Main.cc:22:3: error: 'cout' does not name a type
  }cout<