Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
115051 | 谭哲曦 | 13求1+2-3+4-5+……n的值 | C++ | Compile Error | 0 MS | 0 KB | 258 | 2025-03-27 22:33:14 |
#include <iostream> uing namespace std; int main() { int n ,sum = 1; cin >> n; for(int i=2;i < = n;i++) { if( i%2 == 0) sum +=i; else sum -=i; } cout<< sum <<endl; return 0; }
Main.cc:2:1: error: 'uing' does not name a type uing namespace std; ^ Main.cc: In function 'int main()': Main.cc:6:5: error: 'cin' was not declared in this scope cin >> n; ^ Main.cc:6:5: note: suggested alternative: In file included from Main.cc:1:0: /usr/include/c++/5/iostream:60:18: note: 'std::cin' extern istream cin; /// Linked to standard input ^ Main.cc:7:21: error: expected primary-expression before '=' token for(int i=2;i < = n;i++) ^ Main.cc:14:5: error: 'cout' was not declared in this scope cout<< sum <& __os) ^