Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
131168 晏莞煜 函数求和 C++ Compile Error 0 MS 0 KB 244 2025-09-21 11:54:27

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int qiu_he(int a,int b){ sum=0 for(int i=a;i<=b;i++){ sum+=i; } return sum; } int main(){ cout<<qiu_he(1,10)<<endl; cout<<qiu_he(20,30)<<endl; cout<<qiu_he(35,45); return 0; }


Run Info:

Main.cc: In function 'int qiu_he(int, int)':
Main.cc:4:2: error: 'sum' was not declared in this scope
  sum=0
  ^
Main.cc:5:14: error: 'i' was not declared in this scope
  for(int i=a;i<=b;i++){
              ^