编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#103437 #105. zxh的继承顺位 Compile Error 0 0 ms 0 K C++ 11 / 426 B 西安交通大学 2024-03-18 15:49:23
显示原始代码
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
    int n = 0;
    int flag = 2;
    cin >> n;
    if (n == 1)
        return 2;
    for (int i = 3;; i++) {
        for (int j = 2; j < n; j++) {
            if (i % j == 0) {
                break;
            }
        }
        if (j == k)
            flag++;
        if (flag == n)
            break;
    }
    return i;
}

编译信息

/sandbox/1/a.cpp:8:5: error: expected primary-expression before 'int'
    8 |     int n=0;
      |     ^~~
/sandbox/1/a.cpp:8:5: error: expected '}' before 'int'
/sandbox/1/a.cpp:7:1: note: to match this '{'
    7 | {
      | ^
/sandbox/1/a.cpp:10:5: error: 'cin' does not name a type
   10 |     cin>>n;
      |     ^~~
/sandbox/1/a.cpp:11:5: error: expected unqualified-id before 'if'
   11 |     if(n==1)
      |     ^~
/sandbox/1/a.cpp:13:5: error: expected unqualified-id before 'for'
   13 |     for(int i=3;;i++)
      |     ^~~
/sandbox/1/a.cpp:13:18: error: 'i' does not name a type
   13 |     for(int i=3;;i++)
      |                  ^
/sandbox/1/a.cpp:27:5: error: expected unqualified-id before 'return'
   27 |     return i;
      |     ^~~~~~
/sandbox/1/a.cpp:29:1: error: expected declaration before '}' token
   29 | }
      | ^