ich find den fehler nicht - bin ich blind?!
-
Da ich nun schon ne ewigkeit davorsitze und den fehler nicht finde, frag ich euch. borland bringt mir bei kompilieren immer ne meldung:Fehler: "*****.cpp(47,175):Function call missing )"
das ist konkret diese zeile:
ALPHA2 = atan(-cos(PSI)/tan(BETA_P)-K*sqrt((cos(PSI)*cos(PSI)+sin(BETA_P)*sin(BETA_P)-sin(BETA_P)*sin(BETA_P)*(cos(PSI)*cos(PSI))/(sin(BETA_P)*sin(BETA_P)))*180/3.1415926;
um ganz genau zu sein, ist es genau nach der 3.14
ich bin mir eigentlich keiner schuld bewusst. ich hoffe ihr könnt mir helfen!
hier nochmal der ganze Code. ich weiß quick&dirty, aber ich hab grad alles andere als programmieren zu tun...
#include <stdio.h> #include <math.h> int main(void) { float LAMBDA, LAMBDA_S, LAMBDA_P, BETA_P, ALPHA, ALPHA2, PSI, DELTA, K=0.151275236; //K=R/R_S int i; printf("Geogr. Länge des Satelliten (-180...180) = "); scanf("%lf", &LAMBDA_S); printf("Geogr. Länge des Beobachtungspunkts (-180...180) = "); scanf("%lf", &LAMBDA_P); printf("Geogr. Breite des Beobachtungspunkts (0...90) = "); scanf("%lf", &BETA_P); LAMBDA = (LAMBDA_P - LAMBDA_S) * 3.1415926 / 180; BETA_P = BETA_P*3.1415926/180; if (sin(BETA_P) > 0) PSI = ((atan(tan(LAMBDA)/sin(BETA_P)))*180/3.1415926); else PSI = 90.0; printf("\nAzimut (PSI) = %lf", PSI); if (sqrt(1-cos(BETA_P)*cos(BETA_P)*cos(LAMBDA)*cos(LAMBDA)) > 0) ALPHA = atan((cos(BETA_P)*cos(LAMBDA)) / (sqrt(1-cos(BETA_P)*cos(BETA_P)*cos(LAMBDA)*cos(LAMBDA))) - K / (sqrt(1-cos(BETA_P)*cos(BETA_P)*cos(LAMBDA)*cos(LAMBDA))))*180/3.1415926; else ALPHA = 90.0; printf("\nElevation (ALPHA) = %lf", ALPHA); printf("\n\nElevationskurve"); printf("\n===============\n\n"); printf("+----------+----------+----------+\n"); printf("| PSI(°) | ALPHA(°) | DELTA(°) |\n"); printf("+----------+----------+----------+\n"); for (i=90;i<=270;i=i+5) { PSI = i*3.1415926/180; LAMBDA = atan(tan(PSI)*sin(BETA_P)); if (sqrt(1-2*K*cos(BETA_P)*cos(LAMBDA)+K*K*cos(BETA_P)*cos(BETA_P)) > 0) DELTA = 180/3.1415926*atan(K*sin(BETA_P) / sqrt(1-2*K*cos(BETA_P)*cos(LAMBDA)+K*K*cos(BETA_P)*cos(BETA_P))); else DELTA = 0; if (tan(BETA_P)>=0) ALPHA2 = atan(-cos(PSI)/tan(BETA_P)-K*sqrt((cos(PSI)*cos(PSI)+sin(BETA_P)*sin(BETA_P)-sin(BETA_P)*sin(BETA_P)*(cos(PSI)*cos(PSI))/(sin(BETA_P)*sin(BETA_P)))*180/3.1415926; else ALPHA2 = 90.0; if (ALPHA2<0) { printf("| nicht anpeilbar |\n"); printf("+----------+----------+----------+\n"); } else { if (BETA_P==0 &&(PSI==90 || PSI ==270)) { printf("| %6.2f | 0...90 | %6.2f |\n", PSI, DELTA); printf("+----------+----------+----------+\n"); } else { printf("| %6.2f | %6.2f | %6.2f |\n", PSI, ALPHA2, DELTA); printf("+----------+----------+----------+\n"); } } } }
-
Wenn ich mich nicht zweimal verzählt habe, fehlen zwei schließende Klammern, das WO überlasse ich dir
-
okay, wenns die klammern sind, krieg ich das hin. nochmal die formal vom papier abtippen...
-
okay fehlende klammern gefunden.
ALPHA2 = 180/3.1415926*(atan(((-cos(PSI)*cos(PSI))/(tan(BETA_P)*tan(BETA_P)))-K*sqrt((cos(PSI)*cos(PSI)+sin(BETA_P)*sin(BETA_P)-sin(BETA_P)*sin(BETA_P)*cos(PSI)*cos(PSI))/(sin(BETA_P)*sin(BETA_P)))));
hab jetzt nur das prob, dass er sich genau bei der formel verabschiedet. er geht in den fall rein, kommt bis zur berechnung und keinen schritt weiter
CPU-Auslastung 100%was macht der da?
-
Nachdem ich zwei schliessende Klammern (siehe Kommentarzeile) ergänzt habe, lies sich das ganze kompilieren und es läuft ohne abzustürzen. Ob die Klammern an der richtigen Stelle eingefügt wurden, musst du selbst prüfen.
#include <stdio.h> #include <math.h> int main(void) { float LAMBDA, LAMBDA_S, LAMBDA_P, BETA_P, ALPHA, ALPHA2, PSI, DELTA, K=0.151275236; //K=R/R_S int i; printf("geogr. Laenge des Satelliten (-180...180) = "); scanf("%lf", &LAMBDA_S); printf("geogr. Laenge des Beobachtungspunkts (-180...180) = "); scanf("%lf", &LAMBDA_P); printf("geogr. Breite des Beobachtungspunkts (0...90) = "); scanf("%lf", &BETA_P); LAMBDA = (LAMBDA_P - LAMBDA_S) * 3.1415926 / 180; BETA_P = BETA_P*3.1415926/180; if (sin(BETA_P) > 0) { PSI = ((atan(tan(LAMBDA)/sin(BETA_P)))*180/3.1415926); } else { PSI = 90.0; } printf("\nAzimut (PSI) = %lf", PSI); if (sqrt(1-cos(BETA_P)*cos(BETA_P)*cos(LAMBDA)*cos(LAMBDA)) > 0) { ALPHA = atan((cos(BETA_P)*cos(LAMBDA)) / (sqrt(1-cos(BETA_P)*cos(BETA_P)*cos(LAMBDA)*cos(LAMBDA))) - K / (sqrt(1-cos(BETA_P)*cos(BETA_P)*cos(LAMBDA)*cos(LAMBDA))))*180/3.1415926; /* hier wurden am Ende noch zwei schliessende Klammern eingefuegt */ } else { ALPHA = 90.0; } printf("\nElevation (ALPHA) = %lf", ALPHA); printf("\n\nElevationskurve"); printf("\n===============\n\n"); printf("+----------+----------+----------+\n"); printf("| PSI(°) | ALPHA(°) | DELTA(°) |\n"); printf("+----------+----------+----------+\n"); for (i=90;i<=270;i=i+5) { PSI = i*3.1415926/180; LAMBDA = atan(tan(PSI)*sin(BETA_P)); if (sqrt(1-2*K*cos(BETA_P)*cos(LAMBDA)+K*K*cos(BETA_P)*cos(BETA_P)) > 0) { DELTA = 180/3.1415926*atan(K*sin(BETA_P) / sqrt(1-2*K*cos(BETA_P)*cos(LAMBDA) +K*K*cos(BETA_P)*cos(BETA_P))); } else { DELTA = 0; } if (tan(BETA_P)>=0) { ALPHA2 = atan(-cos(PSI)/tan(BETA_P)-K*sqrt((cos(PSI)*cos(PSI)+sin(BETA_P)*sin(BETA_P) -sin(BETA_P)*sin(BETA_P)*(cos(PSI)*cos(PSI))/(sin(BETA_P)*sin(BETA_P)))))*180/3.1415926; } else { ALPHA2 = 90.0; } if (ALPHA2<0) { printf("| nicht anpeilbar |\n"); printf("+----------+----------+----------+\n"); } else { if (BETA_P==0 &&(PSI==90 || PSI ==270)) { printf("| %6.2f | 0...90 | %6.2f |\n", PSI, DELTA); printf("+----------+----------+----------+\n"); } else { printf("| %6.2f | %6.2f | %6.2f |\n", PSI, ALPHA2, DELTA); printf("+----------+----------+----------+\n"); } } } return 0; }