【发布时间】:2017-11-09 05:37:45
【问题描述】:
好的,我找到了我的问题的真正罪魁祸首,对于那些在此编辑之前在这里的人来说,数字扫描得很好。
void computeDataPoints(F_SELECT *fsPtr, int n, double points[][n])
{
int ix; // for indexing points, i.e. columns of 2D array
double x; // for incrementing the value of x
double inc; // incrementation value of x
inc = (fsPtr->xf - fsPtr->x0)/(n-1);
x= fsPtr->x0;
// Setup loop that computes the points and stores in 2D array
for (ix=0; ix<NUM_POINTS; ix = ix + 1)
{
points[X_IX][ix]=x;
points[FX_IX][ix]=calcFx(x, &fsPtr->fNumber);
x = x+ inc;
}
}
我不知道如何解决这个问题并进行了一些搜索,如果有人知道如何正确地通过这个,我会永远爱你
【问题讨论】:
-
您能否说明一下您是如何检查这些值是否正确存储的?
-
你在使用之前没有声明
selectFunction(&fselect);。还有mainreturnsint, notvoid -
“输入点”是什么意思?你的意思是你跳过对
selectFunction的函数调用?那么调试器实际上可能在 外部main函数,因此fselect不再在范围内。 -
与您的问题无关,但您的
do-while循环退出测试与您的错误条件不匹配。具体来说,如果输入大于 5 的数字,则会打印错误消息,但仍会退出循环。 -
使用双精度存储整数有点奇怪。它有效,但将
fNumber设置为int会更有意义。如果有人进入2.3你会怎么做?
标签: c pointers structure codeblocks