Anna10
Badges: 2
#1
Report Thread starter 13 years ago
#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: :confused:

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.');
readln (k );
while (k < 1) or (k > 31) do
begin
writeln ('Wrong!!!');
readln (k);
end;
writeln('Enter the chosen month.(as a digit)') ;
readln (m) ;

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

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

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);
readln ;

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

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

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

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

writeln (day5 div 7);
readln ;

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

end.

Please can anyone help!?!?!?!?!:confused:

Thanks
0
reply
__WiZaRD__
Badges: 2
Rep:
?
#2
Report 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
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

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

Personalise

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
    Postgraduate Open Day Postgraduate
    Wed, 29 Jan '20
  • University of Groningen
    Undergraduate Open Day Undergraduate
    Fri, 31 Jan '20

Have you ever signed up for an open day and then not gone to it?

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

Watched Threads

View All