![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#1
|
|||
|
|||
|
Написал простую программу выводящую ваш знак зодиака. Нужно еще понять как сделать что бы выводился еще и год зодиака (например год скорпиона и т.д) + если кто разбирается и сможет помочь то как ввод данных можно сдлеать через DataTimePicker. Искал информацию но ненашел понятного для себя.
Код:
unit lab12;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ch,mes:integer;
begin
ch:=strtoint(edit1.text);
mes:=strtoint(edit2.text);
if (ch>0) and (ch<32) and (mes>0) and (mes<13) then
case mes of
1:if ch>=20 then Label3.caption:=' Vodoley' else Label3.caption:=' Kozerog';
2:if ch>=20 then Label3.caption:=' Ryba' else Label3.caption:=' Vodoley';
3:if ch>=20 then Label3.caption:=' Owen' else Label3.caption:=' Ryba';
4:if ch>=20 then Label3.caption:=' Telec' else Label3.caption:=' Owen';
5:if ch>=20 then Label3.caption:=' Bliznechy' else Label3.caption:=' Telec';
6:if ch>=20 then Label3.caption:=' Rak' else Label3.caption:=' Bliznechy';
7:if ch>=20 then Label3.caption:=' Lev' else Label3.caption:=' Rak';
8:if ch>=20 then Label3.caption:=' Deva' else Label3.caption:=' Lev';
9:if ch>=20 then Label3.caption:=' Vesy' else Label3.caption:=' Deva';
10:if ch>=20 then Label3.caption:=' Skorpion' else Label3.caption:=' Vesy';
11:if ch>=20 then Label3.caption:=' Strelec' else Label3.caption:=' Skorpion';
12:if ch>=20 then Label3.caption:=' Kozerog' else Label3.caption:=' Strelec';
end
end;
end. |
|
#2
|
||||
|
||||
|
Код:
procedure TForm1.Button1Click(Sender: TObject); var ch,mes,god:word; begin DecodeDate(DataTimePicker1.Date, god, mes, ch); case mes of 1:if ch>=20 then Label3.caption:=' Vodoley' else Label3.caption:=' Kozerog'; 2:if ch>=20 then Label3.caption:=' Ryba' else Label3.caption:=' Vodoley'; 3:if ch>=20 then Label3.caption:=' Owen' else Label3.caption:=' Ryba'; 4:if ch>=20 then Label3.caption:=' Telec' else Label3.caption:=' Owen'; 5:if ch>=20 then Label3.caption:=' Bliznechy' else Label3.caption:=' Telec'; 6:if ch>=20 then Label3.caption:=' Rak' else Label3.caption:=' Bliznechy'; 7:if ch>=20 then Label3.caption:=' Lev' else Label3.caption:=' Rak'; 8:if ch>=20 then Label3.caption:=' Deva' else Label3.caption:=' Lev'; 9:if ch>=20 then Label3.caption:=' Vesy' else Label3.caption:=' Deva'; 10:if ch>=20 then Label3.caption:=' Skorpion' else Label3.caption:=' Vesy'; 11:if ch>=20 then Label3.caption:=' Strelec' else Label3.caption:=' Skorpion'; 12:if ch>=20 then Label3.caption:=' Kozerog' else Label3.caption:=' Strelec'; end Последний раз редактировалось Ildar-tsr, 03.09.2011 в 11:52. |
|
#3
|
|||
|
|||
|
Код:
unit lab12;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Edit1: TEdit;
Edit2: TEdit;
DateTimePicker1: TDateTimePicker;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var ch,mes,god:word;
begin
DecodeDate(DataTimePicker1.Date, god, mes, ch);
if (ch>0) and (ch<32) and (mes>0) and (mes<13) then
case mes of
1:if ch>=20 then Label3.caption:=' Vodoley' else Label3.caption:=' Kozerog';
2:if ch>=20 then Label3.caption:=' Ryba' else Label3.caption:=' Vodoley';
3:if ch>=20 then Label3.caption:=' Owen' else Label3.caption:=' Ryba';
4:if ch>=20 then Label3.caption:=' Telec' else Label3.caption:=' Owen';
5:if ch>=20 then Label3.caption:=' Bliznechy' else Label3.caption:=' Telec';
6:if ch>=20 then Label3.caption:=' Rak' else Label3.caption:=' Bliznechy';
7:if ch>=20 then Label3.caption:=' Lev' else Label3.caption:=' Rak';
8:if ch>=20 then Label3.caption:=' Deva' else Label3.caption:=' Lev';
9:if ch>=20 then Label3.caption:=' Vesy' else Label3.caption:=' Deva';
10:if ch>=20 then Label3.caption:=' Skorpion' else Label3.caption:=' Vesy';
11:if ch>=20 then Label3.caption:=' Strelec' else Label3.caption:=' Skorpion';
12:if ch>=20 then Label3.caption:=' Kozerog' else Label3.caption:=' Strelec';
end
end.
[Error] lab12.pas(41): Undeclared identifier: 'DataTimePicker1' [Error] lab12.pas(41): Not enough actual parameters [Error] lab12.pas(42): ';' expected but 'IF' found [Error] lab12.pas(57): '.' expected but 'END' found Где я так серьезно напортачил? ) Последний раз редактировалось SoHm, 03.09.2011 в 12:36. |
|
#4
|
||||
|
||||
|
Блин прости не DatATimePicker1, а DatETimePicker1
|
|
#5
|
|||
|
|||
|
Точно сам недосмотрел) Осталось только год зодиака понять как и все будет) Я так понимаю нужен какой-то цикл каждые 12 лет меняющий знак на тот же?
|
|
#6
|
|||
|
|||
|
Годы такие:
Крыса (2008), Бык, Тигр, Заяц, Дракон, Змея, Лошадь, Овца, Обезъяна, Петух, Собака, Свинья. Только начало не 1 января, а в какое-то новолуние. Строго говоря, в восточном календаре, животные - это ветки. А есть ещё и стволы (Дерево, Огонь, Земля, Металл (или Золото?), Вода). Каждый ствол идёт 2 года подряд параллельно животному циклу. Поэтому общий цикл составляет 60 лет. |