# Pascal programmingWatch

Announcements
#1
Does anyone know how to programme in Pascal ... it is what i am using for my Computing coursework - The Villiage Hall, Unit 3.

I have hardly started i am getting worried now i want to programme but i done no how to fix this as it does not give me the correct day:

program newannascalculator;

var counter, dayfinal :integer;
k, D, C,m, month1 :integer;
day, day1, day2, day3, day4, day5 :integer;
dayofweek : array [0..6] of String;
month : array [1..12] of String;

//f = k + [(13*m-1)/5] + D + [D/4] + [C/4] - 2*C.

begin
dayofweek[0] := 'Sunday';
dayofweek[1] := 'Monday';
dayofweek[2] := 'Tuesday';
dayofweek[3] := 'Wednesday';
dayofweek[4] := 'Thursday';
dayofweek[5] := 'Friday';
dayofweek[6] := 'Saturday';

month[1]:= 'march';
month[2]:= 'april';
month[3]:= 'may';
month[4]:= 'june';
month[5]:= 'july';
month[6]:= 'august';
month[7]:= 'september';
month[8]:= 'october';
month[9]:= 'november' ;
month[10]:= 'december';
month[11]:= 'january' ;
month[12]:= 'february';

writeln('Enter the chosen date of the month.');
while (k < 1) or (k > 31) do
begin
writeln ('Wrong!!!');
end;
writeln('Enter the chosen month.(as a digit)') ;

writeln('Enter the first two digits chosen year.') ;

writeln('Enter the last two digits of the chosen year.');

counter :=0;

//f = k + [(13*m-1)/5] + D + [D/4] + [C/4] - 2*C.

if m - 1 = 0 then m:= 12 else m := m-1 ;

day := (13*(m))div 5;
writeln (day);

day1 :=k + day ;
writeln (day1);

day2 := day1 + D;
writeln (day2);

day3 := day2 + D div 4;
writeln (day3);

day4 := day3 + C div 4 ;
writeln (day4);
day5 := day4 - 2*C;
writeln (day5);

writeln (day5 div 7);

dayfinal := day5 mod 7;
writeln (dayfinal);
//f - 7*[f/7]
if dayfinal <0
then dayfinal := dayfinal-7*(dayfinal div 7) ;
writeln (dayfinal);
// repeat
//dayofweek :=dayfinal + dayofweek[counter];
writeln (dayofweek[dayfinal]);
//counter :=counter+1;
//until counter=dayfinal;

end.

Thanks
0
13 years ago
#2
you should post this in the Dev subforum in the Technology forum, youde get a lot more replies and help there from experienced programmers.

Wiz
0
X

new posts
Back
to top
Latest
My Feed

### Oops, nobody has postedin the last few hours.

Why not re-start the conversation?

see more

### See more of what you like onThe Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

### University open days

• The University of Law
Solicitor Series: Assessing Trainee Skills – LPC, GDL and MA Law - Guildford campus Postgraduate
Wed, 29 Jan '20
• Nottingham Trent University
Wed, 29 Jan '20
• University of Groningen
Fri, 31 Jan '20

### Poll

Join the discussion

Yes (190)
52.49%
No (172)
47.51%