Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
100510 陈治宸 12奇数和与偶数和 C++ Compile Error 0 MS 0 KB 262 2024-12-08 11:03:25

Tests(0/0):


Code:

#include <iostream> using namespace std; int main() { int m,n; cin >> m >> n; for(m;m<=n;m++){ if(m%2==0) sum1+=m; else sum2+=m; } cout<<"偶数和"<<sum1<<" "<<"奇数和"<<sum2; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:9: warning: statement has no effect [-Wunused-value]
    for(m;m<=n;m++){
         ^
Main.cc:9:11: error: 'sum1' was not declared in this scope
           sum1+=m;
           ^
Main.cc:11:12: error: 'sum2' was not declared in this scope
            sum2+=m;
            ^
Main.cc:13:24: error: 'sum1' was not declared in this scope
     cout<<"偶数和"<