Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
63429 邓昊源 打印菱形 C++ Compile Error 0 MS 0 KB 374 2024-01-07 17:08:58

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int a,i; cin >> a; for(i=1;i<=a;i++){ for(int k=1;k<=a-i;k++){ cout <<" "; } for(int k=1;k<=2*i-1;k++){ cout <<"*"; } cout <<endl; } for(i=1;i<=a;i++){ for(int k=1;k<=i;k++){ cout <<" "; } for(int k=1;k<=2*n-2*i-1;k++){ cout <<"*"; } } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:21:20: error: 'n' was not declared in this scope
   for(int k=1;k<=2*n-2*i-1;k++){
                    ^