| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 137750 | 刘益梵 | 打印菱形 | C++ | Compile Error | 0 MS | 0 KB | 438 | 2025-11-22 16:23:58 |
#include<iostream> using namespace std; int main() { int n; scanf("%d",&n) ; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n - i; j++) { cout << " "; } for (int j = 1; j <= i * 2 - 1; j++) { printf("*"); } printf("\n") ; } for(int i=1;i<n;i++){ for(int j=1;j<=i;j++){ printf(" "); } for(int j=12;j<={n-i}*2-1;j++){ printf("*"); } printf("\n") } return 0; }
Main.cc: In function 'int main()':
Main.cc:19:19: error: expected primary-expression before '{' token
for(int j=12;j<={n-i}*2-1;j++){
^
Main.cc:19:19: error: expected ';' before '{' token
Main.cc:19:19: error: expected primary-expression before '{' token
Main.cc:19:19: error: expected ')' before '{' token
Main.cc:19:23: error: expected ';' before '}' token
for(int j=12;j<={n-i}*2-1;j++){
^
Main.cc:19:21: warning: statement has no effect [-Wunused-value]
for(int j=12;j<={n-i}*2-1;j++){
^
Main.cc:19:25: error: invalid type argument of unary '*' (have 'int')
for(int j=12;j<={n-i}*2-1;j++){
^
Main.cc:19:29: error: 'j' was not declared in this scope
for(int j=12;j<={n-i}*2-1;j++){
^
Main.cc:23:2: error: expected ';' before '}' token
}
^
Main.cc:5:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&n) ;
^