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

איך קולטים מספר מהמקלדת בC#

Featured Replies

פורסם

כותרת

פורסם
Math.Sqrt(x)
Math.Pow(x)

פורסם
  • מחבר

מישהו יודע איך לקלוט מספרים בCONSOLE בגלל שאם אני עושה

CONSOLE.READ

זה מחזיר את הערך ASCII של המספר

פורסם
  • מחבר

למעלה

פורסם

int i = int.Parse(Console.ReadLine());

int - הגדרת משתנה מסוג integer.

int.Parse - ממיר את הערך ה ASCII לINT.

כנ"ל לרוב שאר סוגי המשתנים:

float.Parse()

וכו'

פורסם
  • מחבר

תודה

פורסם

כמו שאמרו לפני Console.ReadLine

היא הבחירה הנכונה.

אבל להבא שתדע שהפונקציה READ קוראת רק תו אחד ואותו היא ממירה לקוד ASCII

כך שיכולת להכניס גם אות לקליטה.

והתוצאה הייתה ASCII

פורסם
  • מחבר

אני יודע אבל לא רציתי את קוד ה ASCII

פורסם

בגלל זה אמרתי לך שאמרו לפני את הדרך הנכונה....Console.ReadLine

רק רציתי להסביר לך ש Console.Read משיג ASCII גם של אותיות ולא רק מספרים.

ארכיון

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

דיונים חדשים

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.