错误:使用未声明的标识符 'Solution'向量<int> ret = 解决方案().plusOne(param_1); 返回 ret;

error: use of undeclared identifier 'Solution' vector<int> ret = Solution().plusOne(param_1); return ret;

本文关键字:ret 解决方案 返回 plusOne param gt lt 未声明 标识符 错误 向量      更新时间:2024-05-09

尝试将+1添加到第n项***,并在上面提到的leetcode窗口显示错误

#include<iostream>
using namespace std;
int main()
{
int n;
int a[n];//array of n number
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
if(a[i+1]==a[n]) //I am trying to add +1 to nth term of array
{
a[i]=a[i]+1;

}
cout<<a[i];
}
return 0;
}

基本上,我认为您可能已经擦除了leetcode窗口中的所有代码,并将上面的代码粘贴到其中"**类别解决方案{公共:};***"控制台的一部分。尝试重置代码,并将解决方案(仅包括函数(粘贴到类的公共部分下。它应该可以正常工作。

相关文章: