AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Wieder ein Variablen Problem - komme nicht weiter.
Thema durchsuchen
Ansicht
Themen-Optionen

Wieder ein Variablen Problem - komme nicht weiter.

Ein Thema von AlexII · begonnen am 30. Sep 2008 · letzter Beitrag vom 30. Sep 2008
 
AlexII

Registriert seit: 28. Apr 2008
1.717 Beiträge
 
FreePascal / Lazarus
 
#1

Wieder ein Variablen Problem - komme nicht weiter.

  Alt 30. Sep 2008, 13:19
Hallo, muss erst mal sagen, dass bis Gestern nie Probleme oder Fehler mit Variablen hatte, aber seit Gestern schon das zweite und zwar:

Habe bis jetzt diesen Code gehabt:

Delphi-Quellcode:
function RundeAufStelle(zahl: double; stellen: integer): double;
var multi: double;
begin
  multi:=IntPower(10, stellen);
  zahl:=round(zahl*multi);
  result:=zahl/multi;
end;

procedure TForm1.Note;
var note: Real;
begin
if (FiCountCorrect=0) and (jkeins=1) and (jkzwei=1) then
begin
note:=7;
end else if (FiCountCorrect=0) and (jkeins=1) then
         begin
         note:=65/10;
         end else if (FiCountCorrect=0) and (jkzwei=1) then
                  begin
                  note:=65/10;
                  end else if (FiCountCorrect=0) then
                           begin
                           note:=6;
                           end else if (jkeins=1) then
                                    begin
                                    note:=StrToFloat(Label3.Caption);
                                    note:=note+1/2;
                                    end else if (jkzwei=1) then
                                             begin
                                             note:=StrToFloat(Label3.Caption);
                                             note:=note+1/2;
                                             end else
                                                 begin
                                                 note:=StrToFloat(Label3.Caption);
                                                 note:=note-5/15;
                                                 end;
Label3.Caption:=FloatToStr(note);
Label7.Caption:=FloatToStr(RundeAufStelle(StrToFloat(Label3.Caption), 1));
end;
und hab diesen etwas auf diese Version geändert, aber der spinnt jetzt auf ein mal und ich bekomme eine Warnung "[Warnung] MAIN.pas(134): Variable 'cache' ist möglicherweise nicht initialisiert worden" Weiß nicht wo der Fehler liegt.

Delphi-Quellcode:
function RundeAufStelle(zahl: double; stellen: integer): double;
var multi: double;
begin
  multi:=IntPower(10, stellen);
  zahl:=round(zahl*multi);
  result:=zahl/multi;
end;

procedure TForm1.Note;
var note, cache: Real;
begin
if (FiCountCorrect=0) and (jkeins=1) and (jkzwei=1) then
begin
note:=7;
end else if (FiCountCorrect=0) and (jkeins=1) then
         begin
         note:=65/10;
         end else if (FiCountCorrect=0) and (jkzwei=1) then
                  begin
                  note:=65/10;
                  end else if (FiCountCorrect=0) then
                           begin
                           note:=6;
                           end else if (jkeins=1) then
                                    begin
                                    note:=cache;
                                    note:=note+1/2;
                                    end else if (jkzwei=1) then
                                             begin
                                             note:=cache;
                                             note:=note+1/2;
                                             end else
                                                 begin
                                                 note:=cache;
                                                 note:=note-5/15;
                                                 end;
cache:=note;
Label7.Caption:=FloatToStr(RundeAufStelle(cache, 1));
end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:30 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz