עבור לתוכן
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

פורסם

שלום

אני בונה כרגע תוכנית בפסקל ויש לי בתוכנית string שנקלטת על ידי המשתמש ואני רוצה לבדוק תו תו במחרוזת ולראות איזה מספרים יש לי שם.

לכן אני מחפש פקודה או דרך כלשהי להפוך תו המכיל מספר למספר אמיתי.

כלומר אם יש לי תו המכיל את הערך '5' אז אני צריך שהמספר 5 יתקבל במשתנה מספרי כלשהו.

תודה לעוזרים

פורסם

תנסה את זה, לי זה עבד:


program Convert;

var
s: String;
i: Integer;

begin
readln(S);
[b] Val(s,i,i);[/b]
writeln(I)
end.

פורסם

תשתמש בפונקציה

ord(chr)

הפונקציה מחזירה לך את הערך ASCII של התו. חפש באינטרנט טבלת ASCII ולפיה תמיר את מספר התו לספרה האמיתית.

פורסם

הפרוצדורה המתאימה היא Val:

val(str1,value,int);

הפרוצדורה ממירה את המחרוזת str1 למשתנה מספרי value.

במידה והמחרוזת הומרה, המשתנה int יכיל ערך 0 אחרת יכיל המשתנה int את המיקום של התו ש"הפריע" להמרה.

פורסם
  • מחבר

תודה

הפקודה val עובדת.

ארכיון

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

דיונים חדשים

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.