Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7795 柯宇希 x的n次方 C++ Compile Error 0 MS 0 KB 475 2025-05-21 22:34:06

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int number(int x,int n){ int a=x; for(int i=1;i<=n;i++){ int b=a*x; return number(a,n); } cout<<b<<endl; } int main(){ int x,n; cin>>x>>n; cout<<number(x,n)<<endl; return 0; }


Run Info:

Main.cc: In function 'int number(int, int)':
Main.cc:10:13: warning: unused variable 'b' [-Wunused-variable]
         int b=a*x;
             ^
Main.cc:13:11: error: 'b' was not declared in this scope
     cout<b<<endl;
           ^
Main.cc:14:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^