
Problema de Implementation AYUDA
Publicado por Roy (1 intervención) el 02/05/2015 03:50:28
Al tratar de correrlo me aparce el error de implementation
les dejo el codigo, ayuda porfavor
les dejo el codigo, ayuda porfavor

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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
Program edad;
type
TypeMonthArray = array [1..12] of integer;
TypeDate = record
Year,
Month,
Day: word
end;
procedure InitVariables( Var MonthLen: TypeMonthArray;
var CurrentDate: TypeDate);
Function LeapYear ( YearToTest: Word): boolean;
procedure GetInput (Var Birthday: TypeDate;
MonthLen: TypeMonthArray);
Procedure DetermineAge(Var Age: Word;
BirthDay: TypeDate;
CurrenteDate: TypeDate;
MonthLen: TypeMonthArray);
procedure printOutput (Age: word);
implementation
uses
crt,
dos;
procedure InitVariables (var MonthLen: TypeMontharray;
var CurrentDate: TypeDate);
procedure InitDate (var CurrentDate: TypeDate);
var
DummyVar : word;
Begin{InitDate}
With CurrentDate do
GetDate (Year, Month, Day, DummyVar)
end;
procedure InitMonthVar (Var MonthLen: TypeMonthArray);
Begin {InitMonthVar}
MonthLen [1] :=31;
MonthLen [2] :=28;
MonthLen [3] :=31;
MonthLen [4] :=30;
MonthLen [5] :=31;
MonthLen [6] :=30;
MonthLen [7] :=31;
MonthLen [8] :=31;
MonthLen [9] :=30;
MonthLen [10]:=31;
MonthLen [11]:=30;
MonthLen [12]:=31;
end; {InitMonthVar}
Begin
InitMonthVar (MonthLen);
InitDate(CurrenteDate);
end;
function LeapYear (YearToTest : Word) : boolean;
Begin
LeapYear:= (YearToTest mod 4 = 0) and
((YearToTest mod 100 <> 0) or
(YearToTest mod 400 = 0))
end;
procedure GetInput (Var BirthDay: TypeDate;
MonthLen : TypeMontharray);
type
TypeDateStr = String [10];
Var
DateEntered: TypeDateStr;
ValidDate: Boolean;
function NextPart (Var DateEntered: TypeDateStr) : word;
Var
NumString: TypeDateStr;
ErrorCode,
ActualNum: integer;
Begin
NumString:= ' ';
repeat
NumString:= concat (Numstring,
copy (DateEntered, 1 , 1));
DateEntered:= copy (Date entered, 2,
legth (DateEntered)-1)
Until (DateEntered [1]= ' / ' ) or(lenght (DateEntered) = 0);
DateEntered:= copy(DateEntered) 2, leght (DateEntered) - 1);
Val (NumString, ActualNum, ErrorCode);
NextPart:= ActualNum;
if (ErrorCode <> 0)
then
NextPart:= 0
end;
Begin
repeat
ClrScr;
write('Proporcione su fecha de nacimiento en el formato --/--/----: ');
readln (DateEntered);
BirthDay.Month:= NextPart (DateEntered);
BirthDay.Day:= NextPart (DateEntered);
BirthDay.Year:= NextPart (DateEntered);
ValidDate:= ((BirthDay.Month < 13) and
BirthDay.Month <0)) and
(((Birthday.Day <= MonthLen
[BirthDay.Month]) And
(BirthDay.Day > 0)) or
(LeapYear (BirthDay.Year) and
(BirthDay.Month=2 ) and
((BirthDay.Month = 29))) and
(BirthDay.Year <> 0);
Until ValidDate
end;
procedure DetermineAge (Var Age : word;
BirthDay: TypeDate;
CurrentDate: TypeDate;
MonthLen : TypeMonthArray);
Var
YearCounter : word;
function NumbersDaysPastInYr (DateToDo : TypeDate;
MonthLen : TypeMonthArray) word;
Var
TempValue, MonthCounter: word;
Begin
TempValue:= 0;
For MonthCounter:= 1 to (DateToDo.Month - 1) do
TempValue:= TempValue + DateToDo.Day;
if LeapYear (DateToDo.Year) and (DateToDo.Month > 2)
then
TempValue:= TempValue + 1;
NumDaysPastInYr: TempValue
end;
function NumberDaysInYr (YearToDetermine : word) : word;
Begin
If LeapYear (YearToDetermine)
then
NumDaysInYr:= 366
else
NumDaysInYr:= 365
end;
Begin
Age:= NumDaysInYr (BirthDay.Year) -
NumDaysPastInYr(BirhtDay, MonthLen);
For YearCounter:= (BirthDay.Year + 1) to
(CurrentDate.Year - 1) do;
Age:= Age + NumDaysInYr (YearCounter);
if (BirthDay.Year= CurrentDate.Year)
then
Age:= Age + NumDaysPastYr (CurrenteDate, MonthLen) -
numDaysInYr (CurrentDate.Year)
else
Age := Age + NumDaysPastYr (CurrentDate, MonthLen)
end;
Procedure PrintOutPut (Age : word);
Begin
Writeln ('Su edad en dias es ',Age, ' . ');
readln
end;
end.
Valora esta pregunta


0