在 for 循环和变量值中获取此代码的多个错误;
getting multiple errors for this code within the for loop and for the variable value;
使用变量值作为数组的大小,但它不会让我这样做。
int main () {
double a,b,N,increment,value;
value=0;
cout<< "enter values for (a,b,N)";
cin>>a;
cin>>b;
cin>>N;
increment= (b-a)/(N-1);
for (int i =0;i<=b;i+=increment){
value = value+i;
}
double sivalues[value];
for (int x=a;i<=b;i+=increment){
sivalues[a]=si(x);
cout<<"si("<<x<<") = "<< sivalues[a];
}
创建数组时放置在 [] 内的项必须是常量。 但是,当您在堆上创建数组时,这不适用。
int mySize = 50;
int myArray[mySize]; // error: mySize must be const
int* myHeapArray = new int[mySize]; // all good! (just don't forget to free the memory)
相关文章:
- 将鼠标悬停在问题上时与预期">"相关的代码错误
- VI工作室代码错误无法打开输出文件主.exe
- 引入参数化构造函数后显示 LNK 2019 未解析外部符号的代码错误
- 有关矩阵的代码错误导致分段错误(内核转储)
- C++ Schannel POST 400 错误代码错误请求
- Java 本机访问代码错误:"Invalid memory access"
- 代码错误修改
- C++代码错误分配
- "_FCbuild"不能用作函数 - C/C++ 代码错误
- 我的代码错误类型警告 1 警告 C4018 和更多错误
- 代码错误(从 1 到 100 找到质数)
- OpenCV VisualStudio,C 代码错误尝试访问像素
- 当我使用的教程完全没有错误时,为什么我的代码错误
- 简单的NOOB C 输入/输出问题:代码错误
- 为什么enumProcessModules返回false值和299代码错误
- WinhttpSetoption()失败设置TLSV1.2,带有错误代码错误_internet_incorrect_ha
- 苹果安全传输代码错误
- C++ - 国际象棋主教移动代码错误
- 导入Python库时,嵌入了Python代码错误
- 编译提升C 代码错误