计划概要(3体问题):错误的C代码:预期标识符或“(”前“{”令牌
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
double ax, ay, t;
double dt;
/* other declarations including file output, N and 6 command line arguments */
...
int main(int argc, char *argv[])
{
int validinput;
...
/* input validation */
output = fopen("..", "w");
...
/* output validation */
for(i=0; i<=N; i++)
{
t = t + dt;
vx = ...
x = ...
vy = ...
y = ...
fprintf(output, "%lf %lf %lf\n", t, x, y);
}
fclose (output);
}
/* ext function to find ax, ay at different ranges of x and y */
{
declarations
if(x < 1)
{
ax = ...
}
else if(x==1)
{
ax = ...
}
...
else
{
...
}
if(y<0)
{
...
}
...
}
我上线“{/ *分机功能的错误找AX,AY在x和y * /”的不同范围的说法"error: expected identifier or '(' before '{' token"
我认为这可能是由于没有电话或以正确的方式
你的评论是错误的, 它应该是/ *分机功能...和***不*** * \分机功能 – pezcode
感谢downvoting和转换我的答案。他在代码中发布了无效注释块,并在同一行中报告了_syntax_错误。在帮助人们之前,我只会三思而后行,所以我不会干涉你对常见问题的解释。 – pezcode