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

איך ממירים מ float ל- char[]?

Featured Replies

פורסם

ב c++ וההפך

char str[];
float a = 9.5;

how to convert a into str?
what the size of str shuld be? (not dinamic allocation)

hwo to convert from char[] to floar?

פורסם

sprintf(str, "%f", a);

עריכה -

לFLOAT יש 8 ביטים של חזקה

ו23 ביטים של שבר.

המצב הכי גרוע זה חזקה הכי קטנה(0-127), ושבר עם הכי הרבה מספרים. אין לי כוח לחשוב על זה כרגע, אבל תבדוק מה מספר הספרות עם 23 ביטים של שבר.

בנוסף, יש בעיה כאשר החזקה היא הכי גדולה(255-127). שוב, גם כאן צריך לבדוק מתי יש הכי הרבה ספרות של שבר(אותו מספר ממקודם פחות מספר המקומות שהזזת את הנקודה בהכפלה בחזקה).

פורסם
  • מחבר

א. תודה.

ב. לא הבנתי מה ולמה צריך לבדוק. למה זה לא טוב לכל המקרים?

ג. איך ממירים ממערך char ל -float?

פורסם

char *s;
....

float f;

sscanf(s, "%f", f);

הבדיקות של האורך המקסימאלי של המחרוזת נובעת מהמבנה של הFLOATING POINT. יש ביט אחד של סימן(חיובי/שלילי), 8 ביטים לחזקה, ועוד 23 ביטים שמציינים את השבר.

פורסם

stringstream

strtod

scanf

פורסם

אחלה , זה פתר לך את הבעיה ?

פורסם
  • מחבר
:xyxthumbs:

ארכיון

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

דיונים חדשים

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.