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:

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.

Thanks
0
reply
*Mike*
Badges: 1
Rep:
?
#2
Report 13 years ago
#2
ahhhhh, bot attack!!!

maybe it would help if you reposted this in the dev section instead of double posting it here.
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

  • SOAS University of London
    Development Studies, Interdisciplinary Studies, Anthropology and Sociology, Languages, Cultures and Linguistics, Arts, Economics, Law, History, Religions and Philosophies, Politics and International Studies, Finance and Management, East Asian Languages & Cultures Postgraduate
    Sat, 25 Jan '20
  • University of Huddersfield
    Undergraduate Open Day Undergraduate
    Sat, 25 Jan '20
  • The University of Law
    Solicitor Series: Assessing Trainee Skills – LPC, GDL and MA Law - Guildford campus Postgraduate
    Wed, 29 Jan '20

How many uni open days have you been to/did you go to?

0 (80)
28.78%
1 (45)
16.19%
2 (42)
15.11%
3 (39)
14.03%
4 (20)
7.19%
5 (21)
7.55%
6 (7)
2.52%
7+ (24)
8.63%

Watched Threads

View All
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