Berechnung fehl geschlagen im String grid



  • 😉 Danke noch mal für die Hilfe



  • in einem anderen Programm klappt das

    void __fastcall TForm1::Button3Click(TObject *Sender)
    {
    double e,B1,B2,L1,L2;
    
    B1 = StrToFloat(Edit1->Text);
    B2 = StrToFloat(Edit3->Text);
    L1 = StrToFloat(Edit2->Text);
    L2 = StrToFloat(Edit4->Text);
    
    e = (acos(sin(B1*(M_PI/180)) * sin(B2*(M_PI/180)) + cos(B1*(M_PI/180)) * cos(B2*(M_PI/180)) * cos((L1*(M_PI/180)) - (L2*(M_PI/180)))))*6378,3;
    Edit5->Text =FloatToStr(e);
    


  • JA ES KLAPPT !!!!
    Hab mal das andere Programm genommen und es verknüft jetzt klappt es

    if (i>1)
                                    {
                                    B1 = StrToFloat(SG1->Cells[2][i]);
                                    L1 = StrToFloat(SG1->Cells[3][i]);
                                    B2 = StrToFloat(SG1->Cells[2][i-1]);
                                    L2 = StrToFloat(SG1->Cells[3][i-1]);
                                    e = (acos(sin(B1*(M_PI/180)) * sin(B2*(M_PI/180)) + cos(B1*(M_PI/180)) * cos(B2*(M_PI/180)) * cos((L1*(M_PI/180)) - (L2*(M_PI/180)))))*6378,3;
                                           SG1->Cells[10][i] =FloatToStr(e);
    

    }


Anmelden zum Antworten