計劃概要(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