AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Zahlensystem Oktal fehler

Ein Thema von Matz4000 · begonnen am 23. Dez 2010 · letzter Beitrag vom 23. Dez 2010
 
Matz4000

Registriert seit: 21. Dez 2010
14 Beiträge
 
#1

Zahlensystem Oktal fehler

  Alt 23. Dez 2010, 14:18
Delphi-Version: 7
Hey Leute,
hab n kleines Problem...irgendwie spinn ich solangsam, weil ich den ganzen Morgen schon an diesem Blöden Prog. sitze -.-
Hier Mein Quellcode:

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, math, StrUtils;

type
  TForm1 = class(TForm)
    Eingabefeld: TEdit;
    Button1: TButton;
    Label1: TLabel;
    Button2: TButton;
    RadioGroup1: TRadioGroup;
    RadioGroup2: TRadioGroup;
    Ausgabefeld: TEdit;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  BinArray: Array [1..16] of Integer; // Aus Internet erworben
  laenge: Integer;
  Zahl: Integer;
  BolPruef : Boolean;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;

procedure TForm1.Button2Click(Sender: TObject);
function FOctToDec(FWert: String): String;
function FBinToHex(FWert: String): String;
function FDecToBin(FWert: String): String;

var h,d,b,x,a,y,i:Integer;
    c:extended;
    s:string;
begin
{Hexadezimal in Dezimal}
if (Radiogroup1.ItemIndex=1) and (Radiogroup2.itemindex=0) then
     begin
        h:=strtoint('$' + Eingabefeld.Text); //Umwandlung von h in Integer, Methode mit Dollarzeichen aus Internet erworben.
        Ausgabefeld.Text:=inttostr(h); //Ausgabe von h

     end;
{Dezimal in Hexadezimal}
if (Radiogroup1.itemindex=0) and (Radiogroup2.itemindex=1) then
     begin
        d:=strtoint(Eingabefeld.text); //Umwandlung von d in Integer
        Ausgabefeld.text:=Format('%x',[d]); //Ausgabe von d, Methode mit Format(...) aus Internet erworben.
     end;
{Dezimal in Binär}
if (Radiogroup1.itemindex=0) and (Radiogroup2.ItemIndex=2) then
     begin
        Ausgabefeld.Text:=''; //Löschen Des Textes Im Ausgabefeld,sonst kommt das Ergebnis der darauffolgenden Rechnung dazu
        b:=strtoint(Eingabefeld.text); //Umwandlung von b in Integer
         For x:= 1 to 16 do
                                                                               //Formel für Umrechnung aus Internet erworben, wären nie drauf gekommen.
              Begin
                BinArray[x]:= b mod 2;
                b := b div 2;
                Ausgabefeld.Text:= InttoStr(BinArray[x])+Ausgabefeld.text;
                  If b = 0 Then
                  break;
              end;
      end;
{Binär in Dezimal}
if (Radiogroup1.itemindex=2) and (Radiogroup2.ItemIndex=0) then
     begin s:=reversestring(Eingabefeld.text); //Drehen des Eingabestrings
           a:= Length(s); //Ermittlung der Länge des Eingabetextes/Eingabestrings
           c:= 0; //c wird auf 0 deklariert

      For y:= 1 to a do
        begin
          c := c+ Strtoint(s[y]) * power(2 , (-1 + y) );
        end;
            Ausgabefeld.Text:= FloattoStr(c); //Ausgabe von c
     end;
{Oktal in...}
if Radiogroup1.ItemIndex=3 then
    begin
      for i := 1 to Length(Eingabefeld.Text) do
        BolPruef := Eingabefeld.Text[i] in ['0'..'7']; //Eingabe Überprüfen, Bolpruef aus Internet erworben
      if BolPruef = True then
        begin
          if Radiogroup1.ItemIndex=0 then Ausgabefeld.text := FOctToDec(Eingabefeld.Text); //Umwandlung von Oktal in Dezimal
          if Radiogroup1.ItemIndex=1 then Ausgabefeld.text := FBinToHex(FDecToBin(FOctToDec(Eingabefeld.Text))); //Erst Umwandlung von Oktal in Dezimal, dann von Dezimal in Binär, und schließlich von Bimär in Hexadezimal
          if Radiogroup1.ItemIndex=2 then Ausgabefeld.text := FDecToBin(FOctToDec(Eingabefeld.Text)); //Erst Umwandlung von Oktal in Dezimal, dann von Dezimal in Hexadezimal
          if Radiogroup1.ItemIndex=3 then Ausgabefeld.text := Eingabefeld.Text;
        end
      else
        application.messagebox('Wert nicht Oktal','Oktalsystem',MB_OK); //Fehlermeldung, wenn Inhalt vom Eingabefeld nicht dem Oktalzaflensystem entspricht
    end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Eingabefeld.text:='';
Ausgabefeld.text:='';
end;
end.
Zur Frage: Wenn ich auf "play" drücke, kommen folgende Fehlermeldungen:
[Error] Unit1.pas(108): ';' expected but '.' found
[Error] Unit1.pas(113): ';' expected but '.' found
[Error] Unit1.pas(116): Declaration expected but end of file found
[Error] Unit1.pas(21): Unsatisfied forward or external declaration:
'TForm1.Button3Click'


Was mach ich falsch??

Danke im Vorraus, Gruß
Michael


Achso zur Information: Ist ein Projekt für Informatik.. Deswegen die Bemerkungen
  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 15:36 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz