| Autor |
Beitrag |
Firemox
Hält's aus hier
Beiträge: 5
|
Verfasst: Mi 01.02.06 19:07
Heey leute,
hab seit nem halebn jahr Informatik, und wollt jezz nen Programm erstellen, wo ich
die Temperatur eingeb, und dann auf eine Einheit klick (RadioGroup; Kelvin, Fahrenheit und Celsius)
und mir das programm dann die temperatur in den 3 einheiten angibt^^
Nach langem probieren und recherchieren hab ichs aufgegeben. Wär nett wenn mir des einer anschaulich erklären kann,
und nicht nur den Quelltext schreibt xD
Hoff ihr könnt mir helfen
MFG Firemox
|
|
Pdd
      
Beiträge: 142
Win XP
Delphi 7
|
Verfasst: Mi 01.02.06 19:14
naja wie wärs denn damit: temperatur in eine varriable laden und dann die formel berenne kp, wie die heist!
also celsius:=strtoint(edit1.text) und dann eben edit2.text:=inttostr(celsius*FORMEL);
so in etwa.. 
|
|
Marco D.
      
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Mi 01.02.06 19:15
Hallo,
wo dran bist du denn gescheitert?
An der Umrechnung oder an der Abfrage mit der Radiogroup?
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
Firemox 
Hält's aus hier
Beiträge: 5
|
Verfasst: Mi 01.02.06 19:18
ja bin an der abfrage gescheitert...umrechnen und so weiß ich schon, aba bräucht mal nen tipp wie ich des machen könnt...bis freitag 12.50Uhr xD
aba schon ma thx
|
|
Marco D.
      
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Mi 01.02.06 19:24
Poste mal bitte in mathematischer Schreibweise die Berechnungsformeln.
Verstehe ich das so richtig:
Du hast ein Edit. Dort gibts du einen Wert ein (eine Zahl - real oder integer?) und dann klickst du in der Radiogroup auf das, in welcher Einheit der Wert ist? So dass dann die beiden anderen Werte berechnet werden.
Wenn nicht, dann erkläre bitte nocheinmal 
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
Firemox 
Hält's aus hier
Beiträge: 5
|
Verfasst: Mi 01.02.06 19:29
richtig =)
Fahrenheit=Celsius*1,8+32
Kelvin=Celsius+273
also vll bekommts einer hin, bin dann ma weg
thx nomal
|
|
Marco D.
      
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Mi 01.02.06 19:47
Oki, ich progge dann mal was...
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
Firemox 
Hält's aus hier
Beiträge: 5
|
Verfasst: Do 02.02.06 13:28
ah cool, des wär spitze =)
danke schonma
|
|
Marco D.
      
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Do 02.02.06 20:41
So, da is es.
Einloggen, um Attachments anzusehen!
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
Gausi
      
Beiträge: 8554
Erhaltene Danke: 481
Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
|
Verfasst: Do 02.02.06 20:47
Auch wenn ichs nicht in Auftrag gegeben habe: Ganz nett - bis auf einen einen kleinen Schönheitsfehler: Ne Bereichsüberprüfung wäre nett: Eine Temperatur von -42 Kelvin ist wirklich zu kalt 
_________________ We are, we were and will not be.
|
|
Marco D.
      
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Do 02.02.06 21:03
Ja kriegen wir doch ganz fix hin 
Einloggen, um Attachments anzusehen!
_________________ Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
|
|
Blackheart666
      
Beiträge: 2195
XP
D3Prof, D6Pers.
|
Verfasst: Do 02.02.06 22:34
Ich weiss nicht was Du für eine Delphi Version hast aber
Unter Delphi 7 ist auf jedem Fall im Ordner Demos "ConvertIt" zu Finden was genau das Thema unter anderem behandelt.
|
|
Firemox 
Hält's aus hier
Beiträge: 5
|
Verfasst: Fr 03.02.06 13:14
ah, vielen dank koller!!! genau so wollt ichs
aber könntest du noch den quelltext schicken, weil ich wills ja au verstehen und probieren 
|
|
Marco D.
      
Beiträge: 2750
Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
|
Verfasst: Fr 03.02.06 20:48
Hallo,
Hier der Quellcode:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110:
| unit main;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, XPMan, StdCtrls, ExtCtrls;
type TTemperatur = (tpCelsius,tpFahrenheit,tpKelvin); TForm1 = class(TForm) Label1: TLabel; RadioGroup1: TRadioGroup; XPManifest1: TXPManifest; Label2: TLabel; Label3: TLabel; Label4: TLabel; eeingabe: TEdit; Button1: TButton; acelsius: TLabel; afahrenheit: TLabel; akelvin: TLabel; Button2: TButton; Label5: TLabel; Label6: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormCreate(Sender: TObject); private public end;
var Form1: TForm1; fahrenheit,celsius,kelvin:real;
implementation
{$R *.dfm}
procedure Berechnen (Einheit : TTemperatur;Wert:real); begin CASE Einheit OF tpCelsius: BEGIN fahrenheit:=wert*1.8+32; kelvin:=wert+273; celsius:=wert; END; tpFahrenheit: BEGIN celsius:=(wert-32)/1.8; kelvin:=(wert-32)/1.8+273; fahrenheit:=wert; END; tpKelvin: BEGIN fahrenheit:=(wert-273)*1.8+32; celsius:=wert-273; kelvin:=wert; END; END; END;
procedure TForm1.Button1Click(Sender: TObject); var temp:TTemperatur; begin IF (form1.eeingabe.text<>'') THEN BEGIN IF (strtofloat(eeingabe.text)<0) and (radiogroup1.itemindex=2) THEN BEGIN showmessage('Neee, das is nen bissl zu kalt...'); exit; END;
CASE Radiogroup1.itemindex OF 0: Berechnen(tpcelsius,strtofloat(eeingabe.Text)); 1: Berechnen(tpfahrenheit,strtofloat(eeingabe.Text)); 2: Berechnen(tpkelvin,strtofloat(eeingabe.text)); END;
acelsius.caption:=floattostr(celsius); afahrenheit.caption:=floattostr(fahrenheit); akelvin.caption:=floattostr(kelvin); END;
end;
procedure TForm1.Button2Click(Sender: TObject); begin close; end;
procedure TForm1.FormCreate(Sender: TObject); begin acelsius.caption:=''; afahrenheit.caption:=''; akelvin.caption:=''; end;
end. |
Anfragen zum Quellcode bitte hier posten.
|
|