| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 98231 | 梁敖铭 | 求绝对值 | C++ | Compile Error | 0 MS | 0 KB | 240 | 2024-11-17 15:38:40 |
#include <iostream> #include <cstdlib> // 包含abs函数的库 int main() { int number; cin >> number; if (number < 0) { cout << abs(number); } else { cout << number ; } 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);
^
Main.cc:9: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:9: error: 'cout' was not declared in this scope
cout << number ;
^
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
^