| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 92466 | 梁敖铭 | 求绝对值 | C++ | Compile Error | 0 MS | 0 KB | 254 | 2024-10-04 21:40:44 |
#include <iostream> #include <cstdlib> // 包含abs函数的库 int main() { int number; cin >> number; if (number < 0) { cout << abs(number) <<endl; } else { cout << number << endl; } return 0; }
Main.cc: In function 'int main()':
Main.cc:6:1: error: 'cin' was not declared in this scope
cin >> number;
^
Main.cc:6:1: 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:9:9: error: 'cout' was not declared in this scope
cout << abs(number) <& __os)
^
Main.cc:11:9: error: 'cout' was not declared in this scope
cout << number << endl;
^
Main.cc:11:9: note: suggested alternative:
In file included from Main.cc:1:0:
/usr/include/c++/5/iostream:61:18: note: 'std::cout'
extern ostream cout; /// Linked to standard output
^
Main.cc:11:28: error: 'endl' was not declared in this scope
cout << number << endl;
^
Main.cc:11:28: note: suggested alternative:
In file included from /usr/include/c++/5/iostream:39:0,
from Main.cc:1:
/usr/include/c++/5/ostream:590:5: note: 'std::endl'
endl(basic_ostream<_CharT, _Traits>& __os)
^