3 Replies - 591 Views - Last Post: 21 August 2017 - 10:52 AM Rate Topic: -----

#1 b17g  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 21-August 17

I'm new and learning, need help (Pascal)

Posted 21 August 2017 - 10:04 AM

Have a *** of a program here and have no idea why line 19 is giving syntax error

Program calculator;

// s = soma
// u = subtrair
// m = multiplicar
// d = dividir
// n1 = numero 1
// n2 = numero 2
// b = bystander

Uses crt;

Var s : integer;
    u : integer;
    m : real;
    d : real;

BEGIN
    Procedure mais;
        begin
            b := n1 + n2;
            Writeln(B)/>/>/>;
        end;

    Procedure menos;
        begin
            b := n1 - n2;
            Writeln(B)/>/>/>;
        end;
    
    Procedure vezes;
        begin
            b := n1 * n2;
            Writeln(B)/>/>/>;
        end;
    
    Procedure dividir;
        begin
            b := n1 / n2;
            Writeln(B)/>/>/>;
        end;
    
    Writeln("What's the operation?");
    Writeln("1) +");
	Writeln("2) -");
	Writeln("3) *");
	Writeln("4) /");
	Writeln("Select the number of the operation you wish to conduct");
	Readln(B)/>/>/>;
	Writeln("Now write your first number");
	Readln(n1);
	Writeln("And now, the second number");
	Readln(n2);
	If b=1 then
	    mais;
	Else
	    If b=2 then
	        menos;
	    Else
	        If b=3 then
	            vezes;
	        Else
	            If b=4 then
	                dividir;
	            Else
	                Writeln("Non-available operation");
End.


That's the program, the error is in line 19
(The site also wouldn't allow me to put attachment >.</>/>)
P.S. The sunglasses smileys are (b.) without the "."

This post has been edited by andrewsw: 21 August 2017 - 10:33 AM
Reason for edit:: added missing [code][/code] tags


Is This A Good Question/Topic? 0
  • +

Replies To: I'm new and learning, need help (Pascal)

#2 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6375
  • View blog
  • Posts: 25,756
  • Joined: 12-December 12

Re: I'm new and learning, need help (Pascal)

Posted 21 August 2017 - 10:34 AM

Please wrap your code in code tags, it shows how to do this directly in the area where you type your post. I have added them for you.

Is your line 19 "Procedure mails;" as it is in the posted code? And what is the error message? Quote it exactly.

I have also removed the profanity, there is no need for this, particularly on your first post.
Was This Post Helpful? 0
  • +
  • -

#3 b17g  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 21-August 17

Re: I'm new and learning, need help (Pascal)

Posted 21 August 2017 - 10:38 AM

Free Pascal Compiler version 3.0.0 [2015/11/20] for x86_64
Copyright © 1993-2015 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling jdoodle.pas
jdoodle.pas(19,6) Error: Illegal expression
jdoodle.pas(19,16) Fatal: Syntax error, ";" expected but "identifier MAIS" found
Fatal: Compilation aborted
Error: /usr/bin/ppcx64 returned an error exitcode
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6375
  • View blog
  • Posts: 25,756
  • Joined: 12-December 12

Re: I'm new and learning, need help (Pascal)

Posted 21 August 2017 - 10:52 AM

I haven't touched Pascal for years. I suspect that the procedure should be outside of the Begin on line 18, which begins the program. a ref

You might wait a little while for a Pascal-er to surface.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1