Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
158851 陈襗葳 打印数字图形 C++ Compile Error 0 MS 0 KB 784 2026-08-22 17:57:59

Tests(0/0):


Code:

include <iostream> using namespace std; int main(){ int n; while (cin >> n){ for(int i = 1; i <= n; i++){ for(int j = 1; j <= n - i; j++){ cout << ' '; } for(int j = 1; j <= i; j++){ cout << j; } for(int j = i - 1; j >= 1; j--){ cout << j; } cout << endl; } for(int i = n - 1; i >= 1; i--){ for(int j = 1; j <= n - i; j++){ cout << ' '; } for(int j = 1; j <= i; j++){ cout << j; } for(int j = i - 1; j >= 1; j--){ cout << j; } cout << endl; } } }


Run Info:

Main.cc:1:1: error: 'include' does not name a type
 include 
 ^
Main.cc: In function 'int main()':
Main.cc:5:12: error: 'cin' was not declared in this scope
     while (cin >> n){
            ^
Main.cc:8:17: error: 'cout' was not declared in this scope
                 cout << ' ';
                 ^
Main.cc:11:17: error: 'cout' was not declared in this scope
                 cout << j;
                 ^
Main.cc:14:17: error: 'cout' was not declared in this scope
                 cout << j;
                 ^
Main.cc:16:13: error: 'cout' was not declared in this scope
             cout << endl;
             ^
Main.cc:16:21: error: 'endl' was not declared in this scope
             cout << endl;
                     ^
Main.cc:20:17: error: 'cout' was not declared in this scope
                 cout << ' ';
                 ^
Main.cc:23:17: error: 'cout' was not declared in this scope
                 cout << j;
                 ^
Main.cc:26:17: error: 'cout' was not declared in this scope
                 cout << j;
                 ^
Main.cc:28:13: error: 'cout' was not declared in this scope
             cout << endl;
             ^
Main.cc:28:21: error: 'endl' was not declared in this scope
             cout << endl;
                     ^