编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#25444 #1139. ddd和鸽子 Compile Error 0 0 ms 0 K C++ / 471 B Eric 2020-05-01 22:01:50
显示原始代码
#include <iostream>
#include <cmath>
#include <cstring>
using namespace std;
int main() {
    string s;
    cin >> s;
    int hour = s[0] - '0';
    hour = hour * 10 + s[1] - '0';
    int min = s[3] - '0';
    min = min * 10 + s[4] - '0';
    hour = hour % 12;
    float degree1 = hour * 30 + min / 2.0;
    float degree2 = min * 6.0;
    if (degree1 - degree2 < 0)
        print("%,1f", degree1 - degree2 + 180);
    else {
        printf("%.1f", degree1 - degree2);
    }
    return 0;
}

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:17:9: error: 'print' was not declared in this scope
         print("%,1f",degree1-degree2+180);
         ^~~~~
/sandbox/1/a.cpp:17:9: note: suggested alternative: 'lrint'
         print("%,1f",degree1-degree2+180);
         ^~~~~
         lrint
/sandbox/1/a.cpp:20:9: error: 'printf' was not declared in this scope
         printf("%.1f",degree1-degree2);
         ^~~~~~
/sandbox/1/a.cpp:20:9: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
/sandbox/1/a.cpp:4:1:
+#include <cstdio>
 using namespace std;
/sandbox/1/a.cpp:20:9:
         printf("%.1f",degree1-degree2);
         ^~~~~~