עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

בעיה עם תוכנה שכתבתי בפסקל צריך עזרה דחוף..

Featured Replies

פורסם

רשמתי תוכנה בפסקל והוא רושם לי בעיה הנה הקוד מקור:

הוא טוען שיש שגיאה ב-end האחרון... מה לעשות?

program project;

var
   con, points : integer;

function hisur:integer;
var
    n1, n2, result, i, l : integer;

begin
    writeln('Choose a level from 1-5.');
    readln(l);

    n1 := random(10)+1+(l-1)*10;
    n2 := random(10)+1+(l-1)*10;

    writeln(n1, '-', n2, '=');

    i := 1;

    while i <= 3 do
    begin
        readln(result);
        if result = n1 - n2 then
        begin
            writeln('Correct.');
            i := 4;
            hisur := 1;
        end
        else
        begin
            writeln('Wrong.');
            i := i+1;
            if i = 4 then
                hisur := 0
            else
                writeln('Try again.');
        end;
    end;
end;

function hibur:integer;
var
    n1, n2, result, i, l : integer;

begin
    writeln('Choose a level from 1-5.');
    readln(l);

    n1 := random(10)+1+(l-1)*10;
    n2 := random(10)+1+(l-1)*10;

    writeln(n1, '+', n2, '=');

    i := 1;

    while i <= 3 do
    begin
        readln(result);
        if result = n1 + n2 then
        begin
            writeln('Correct.');
            i := 4;
            hibur := 1;
        end
        else
        begin
            writeln('Wrong.');
            i := i+1;
            if i = 4 then
                hibur := 0
            else
                writeln('Try again.');
        end;
    end;
end;

function kefel:integer;
var
    n1, n2, result, i, l : integer;

begin
    writeln('Choose a level from 1-5.');
    readln(l);

    n1 := random(10)+1+(l-1)*10;
    n2 := random(10)+1+(l-1)*10;

    writeln(n1, '*', n2, '=');

    i := 1;

    while i <= 3 do
    begin
        readln(result);
        if result = n1 * n2 then
        begin
            writeln('Correct.');
            i := 4;
            kefel := 1;
        end
        else
        begin
            writeln('Wrong.');
            i := i+1;
            if i = 4 then
                kefel := 0
            else
                writeln('Try again.');
        end;
    end;
end;

function hiluk:integer;
var
    n1, n2, result, i, l : integer;

begin
    writeln('Choose a level from 1-5.');
    readln(l);

    n1 := random(10)+1+(l-1)*10;
    n2 := random(10)+1+(l-1)*10;

    writeln(n1, '/', n2, '=');

    i := 1;

    while i <= 3 do
    begin
        readln(result);
        if result = n1 / n2 then
        begin
            writeln('Correct.');
            i := 4;
            hiluk := 1;
        end
        else
        begin
            writeln('Wrong.');
            i := i+1;
            if i = 4 then
                hiluk := 0
            else
                writeln('Try again.');
        end;
    end;
end;

function main_menu:integer;

var
    a : integer;

begin
    writeln('If you want to lehaber, select 1.');
    writeln('If you want to lehaser, select 2.');
    writeln('If you want to likfol, select 3.');
    writeln('If you want to lehalek, select 4.');
    readln(a);

    case a of
    1: main_menu := hibur;
    2: main_menu := hisur;
    3: main_menu := kefel;
    4: main_menu := hiluk;

end;

begin
    points:=0;

    writeln('Hello.');
    writeln('To continue, enter 1.');
    readln(con);
    while con = 1 do
    begin
        points := points + main_menu;
        writeln('To continue, enter 1.');
    end;

    writeln('Your total score is ', points, '!');
    readln;
end.

פורסם

התוכן של ה-while וה-if לא אמורים להיות בתוך סוגריים?

וגם תנסה להשתמש בdebuger. אולי זה יעזור לך.

פורסם
  • מחבר

התוכן של ה-while וה-if לא אמורים להיות בתוך סוגריים?

וגם תנסה להשתמש בdebuger. אולי זה יעזור לך.

ניסיתי כבר עם ה-debugger הוא אומר על ה-end האחרון שכאילו צריך להיות ; אבל זה לא עוזר...

פורסם

באמת שכחת END אחד... תספור פשוט כמה BEGIN יש וכמה END יש ותראה...

פורסם

באמת שכחת ;end אחרי השורה הלפני האחרונה (;readln)

שכחת לסגור את הפונק'. כנראה התבלבלת אם הend של הפונ' לend של התוכנית.

פורסם
  • מחבר

מישהו יכול לרשום כאן את הקוד עם התיקון?

פורסם

program project;

var
con, points : integer;

function hisur:integer;
var
n1, n2, result, i, l : integer;

begin
writeln('Choose a level from 1-5.');
readln(l);

n1 := random(10)+1+(l-1)*10;
n2 := random(10)+1+(l-1)*10;

writeln(n1, '-', n2, '=');

i := 1;

while i <= 3 do
begin
readln(result);
if result = n1 - n2 then
begin
writeln('Correct.');
i := 4;
hisur := 1;
end;
else
begin
writeln('Wrong.');
i := i+1;
if i = 4 then
hisur := 0
else
writeln('Try again.');
end;
end;
end;

function hibur:integer;
var
n1, n2, result, i, l : integer;

begin
writeln('Choose a level from 1-5.');
readln(l);

n1 := random(10)+1+(l-1)*10;
n2 := random(10)+1+(l-1)*10;

writeln(n1, '+', n2, '=');

i := 1;

while i <= 3 do
begin
readln(result);
if result = n1 + n2 then
begin
writeln('Correct.');
i := 4;
hibur := 1;
end;
else
begin
writeln('Wrong.');
i := i+1;
if i = 4 then
hibur := 0
else
writeln('Try again.');
end;
end;
end;

function kefel:integer;
var
n1, n2, result, i, l : integer;

begin
writeln('Choose a level from 1-5.');
readln(l);

n1 := random(10)+1+(l-1)*10;
n2 := random(10)+1+(l-1)*10;

writeln(n1, '*', n2, '=');

i := 1;

while i <= 3 do
begin
readln(result);
if result = n1 * n2 then
begin
writeln('Correct.');
i := 4;
kefel := 1;
end;
else
begin
writeln('Wrong.');
i := i+1;
if i = 4 then
kefel := 0
else
writeln('Try again.');
end;
end;
end;

function hiluk:integer;
var
n1, n2, result, i, l : integer;

begin
writeln('Choose a level from 1-5.');
readln(l);

n1 := random(10)+1+(l-1)*10;
n2 := random(10)+1+(l-1)*10;

writeln(n1, '/', n2, '=');

i := 1;

while i <= 3 do
begin
readln(result);
if result = n1 / n2 then
begin
writeln('Correct.');
i := 4;
hiluk := 1;
end;
else
begin
writeln('Wrong.');
i := i+1;
if i = 4 then
hiluk := 0
else
writeln('Try again.');
end;
end;
end;

function main_menu:integer;

var
a : integer;

begin
writeln('If you want to lehaber, select 1.');
writeln('If you want to lehaser, select 2.');
writeln('If you want to likfol, select 3.');
writeln('If you want to lehalek, select 4.');
readln(a);

case a of
1: main_menu := hibur;
2: main_menu := hisur;
3: main_menu := kefel;
4: main_menu := hiluk;

end;

begin
points:=0;

writeln('Hello.');
writeln('To continue, enter 1.');
readln(con);
while con = 1 do
begin
points := points + main_menu;
writeln('To continue, enter 1.');
end;

writeln('Your total score is ', points, '!');
readln;
end.

שכחת להוסיף ; אחרי כל END

מקווה שזו הייתה הבעיה :xyxthumbs:

פורסם

אני לא הכי יודע פסקל אבל אתה אמור בלולאה בתוכנית הראשית לקלוט את CON אחרת זה יהיה לולאה אינ-סופית

מקווה שעזרתי לך ;D

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.