Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
158901 汪义罗 函数求和 C++ Compile Error 0 MS 0 KB 251 2026-08-23 12:22:35

Tests(0/0):


Code:

#include<iostream> using namespace std; int getsum(int a,int b){ int sum=0; for(int i=a;i<=b;i++){ sum+=i; } int main() { cout<<getsum(1,10)<<" "; cout<<getsum(10,20)<<" "; cout<<getsum(35,45)<<" "; return 0; return sum; }


Run Info:

Main.cc: In function 'int getsum(int, int)':
Main.cc:8:12: error: a function-definition is not allowed here before '{' token
 int main() {
            ^
Main.cc:15:1: error: expected '}' at end of input
 }
 ^
Main.cc:15:1: warning: no return statement in function returning non-void [-Wreturn-type]