Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
6139 吴承熹 15几个数字组成 C++ Compile Error 0 MS 0 KB 359 2025-01-07 13:19:06

Tests(0/0):


Code:

#include <stdio.h> #include <stdlib.h> int main() { int x; printf("#输入x:"); scanf("%d", &x); int n = _scprintf("%d", x); if (x < 0) { --n; } printf("#您输入的数由%d个数字组成。\r\n", n); system("pause"); } int n = 1; while (x) { x /= 10; ++n; } // n就是位数


Run Info:

Main.cc: In function 'int main()':
Main.cc:9:30: error: '_scprintf' was not declared in this scope
     int n = _scprintf("%d", x);
                              ^
Main.cc: At global scope:
Main.cc:19:1: error: expected unqualified-id before 'while'
 while (x) {
 ^