Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
148384 吴昊 判断素数 C++ Compile Error 0 MS 0 KB 447 2026-02-12 17:50:11

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int a1(int n) { for(int i=2;i<n;i++){ if(a%i==0){ cout<<"prime"<<endl; return 0; } } cout<<"not prime"<<endl; } int main(){ int n,a=0; cin>>n; a1(n) return 0; }


Run Info:

Main.cc: In function 'int a1(int)':
Main.cc:6:11: error: 'a' was not declared in this scope
        if(a%i==0){
           ^
Main.cc: In function 'int main()':
Main.cc:18:4: error: expected ';' before 'return'
    return 0;                                                        
    ^
Main.cc:15:10: warning: unused variable 'a' [-Wunused-variable]
    int n,a=0;
          ^
Main.cc: In function 'int a1(int)':
Main.cc:12:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^