Your Ad Here Your Ad Here
Results 1 to 6 of 6

Thread: pascal help

  1. #1
    thepretender's Avatar Poster BT Rep: +3
    Join Date
    Jan 2009
    Posts
    37
    does anyone know pascal? because i'm having trouble running a program code i made. It won't load?

  2. Internet, Programming and Graphics   -   #2
    SaveFerris's Avatar ŻŻŻŻŻŻŻŻŻŻŻŻ
    Join Date
    Oct 2006
    Location
    England
    Posts
    224
    You should probably post the code you're using, and be more specific with your problem.

  3. Internet, Programming and Graphics   -   #3
    Barbarossa's Avatar mostly harmless
    Join Date
    Jun 2002
    Location
    Over here!
    Posts
    19,631
    Post the code already. I know a bit of pascal.

  4. Internet, Programming and Graphics   -   #4
    thepretender's Avatar Poster BT Rep: +3
    Join Date
    Jan 2009
    Posts
    37
    alright relax dudes..

    PROGRAM Expressions1(OUTPUT);
    BEGIN
    WRITELN;
    WRITELN('A. 15 - 15 DIV 15 = ',15-15 DIV 15);
    WRITELN('B. 22 + 10 / 2 = ', 22+10/2:0:2);
    WRITELN('B. (22 + 10) / 2 = ', (22+10)/2:0:2);
    WRITELN('C. 50 * 10 - 4 MOD 3 * 5 + 80 = ',50*10-4 MOD 3*5+80);
    WRITELN('Press ENTER to continue..');
    READLN
    END.


    my problem is getting the "RUN" function to do its job and display the output program of the code.

  5. Internet, Programming and Graphics   -   #5
    bigboab's Avatar Poster BT Rep: +1
    Join Date
    Jul 2003
    Posts
    30,399
    Quote Originally Posted by thepretender View Post
    alright relax dudes..

    PROGRAM Expressions1(OUTPUT);
    BEGIN
    WRITELN;
    WRITELN('A. 15 - 15 DIV 15 = ',15-15 DIV 15);
    WRITELN('B. 22 + 10 / 2 = ', 22+10/2:0:2);
    WRITELN('B. (22 + 10) / 2 = ', (22+10)/2:0:2);
    WRITELN('C. 50 * 10 - 4 MOD 3 * 5 + 80 = ',50*10-4 MOD 3*5+80);
    WRITELN('Press ENTER to continue..');
    READLN
    END.

    my problem is getting the "RUN" function to do its job and display the output program of the code.

    I don't know what version of Pascal you are using. I am only guessing what you are trying to achieve not having seen the exercise question. If you look at the modified program below(MS-DOS Pascal 6) it might give you an idea where you have gone wrong.

    PROGRAM Expressions1(OUTPUT);
    BEGIN
    WRITELN;
    WRITE('A. (15 minus 15) divided by 15 = , ');
    WRITELN((15-15)/15);
    WRITE('B. (22 plus 10) divided by 2 = , ' );
    WRITELN((22+10)/2);
    WRITE('C. (50 multiplied by 10 minus 4) divided by 3 multiplied by 5 plus 80 = , ');
    WRITELN(((50*10)-4) MOD ((3*5)+80));
    WRITELN('Press ENTER to continue..');
    READLN
    END.

    When doing calculations always do your first calculation inside brackets e.g(10+2). Then add your second calculation enclosing both calculations in brackets e.g.((10+2) * 6) otherwise Pascal will calculate in the following order: *,/,-,+ and that won't necessary give you the result that you originally wanted;

    10+2 * 6 = 22.

    ((10+2) * 6) = 72


    Good luck.
    Last edited by bigboab; 04-19-2009 at 06:25 AM.
    The best way to keep a secret:- Tell everyone not to tell anyone.

  6. Internet, Programming and Graphics   -   #6
    thepretender's Avatar Poster BT Rep: +3
    Join Date
    Jan 2009
    Posts
    37
    Yep.. its more neat and spread out. Thanks!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •