Hey there! Sign in to join this conversationNew here? Join for free
x Turn on thread page Beta

Need help in programming in Pascal watch

Announcements
    • Thread Starter
    Offline

    2
    ReputationRep:
    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
    Offline

    1
    ReputationRep:
    ahhhhh, bot attack!!!

    maybe it would help if you reposted this in the dev section instead of double posting it here.
 
 
 
Reply
Submit reply
Turn on thread page Beta
Updated: April 17, 2006
Poll
Do I go to The Streets tomorrow night?

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.