Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
5110 柯宇希 求点积 C++ Compile Error 0 MS 0 KB 274 2024-11-02 14:38:40

Tests(0/0):


Code:

using namespace std; int main(){ int a[1010],b[1010] cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n;i++){ cin>>b[i]; } for(int i=0;i<n;i++){ s+=a[i]*b[i]; } cout<<s<<endl; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:5: error: expected initializer before 'cin'
     cin>>n;
     ^
Main.cc:5:19: error: 'n' was not declared in this scope
     for(int i=0;i>a[i];
         ^
Main.cc:8:19: error: 'n' was not declared in this scope
     for(int i=0;i>b[i];
         ^
Main.cc:9:14: error: 'b' was not declared in this scope
         cin>>b[i];
              ^
Main.cc:11:19: error: 'n' was not declared in this scope
     for(int i=0;i<n;i++){
                   ^
Main.cc:12:9: error: 's' was not declared in this scope
         s+=a[i]*b[i];
         ^
Main.cc:12:17: error: 'b' was not declared in this scope
         s+=a[i]*b[i];
                 ^
Main.cc:14:5: error: 'cout' was not declared in this scope
     cout<<s<<endl;
     ^
Main.cc:14:11: error: 's' was not declared in this scope
     cout<<s<<endl;
           ^
Main.cc:14:14: error: 'endl' was not declared in this scope
     cout<<s<<endl;
              ^