עבור לתוכן
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 תרגיל שימוש בטבלת ה-ASCII

Featured Replies

פורסם

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

בשאלה זו עליכם לקלוט שני תווים (char) מהמשתמש ולחשב את ההפרש ביניהם לפי טבלת ה ASCII.

התוכנית תדפיס את הערך המוחלט של ההפרש. לדוגמא:

  • עבור התווים ‘B’ ו ‘A’ התוכנית תדפיס 1 כי ערך ה ASCII של ‘A’ הוא 65 ושל B הוא 66.
  • עבור התווים ‘7’ ו ‘@’ התוכנית תדפיס 9.
  • עבור התווים ‘Q’ ו ‘Q’ התוכנית תדפיס 0.

זה בערך לאן הגעתי. כמובן שיש עריכות קטנות..

תודה לעוזרים..

/* ASCII.c */


#include <stdio.h>


int main()
{
char A, B, C;
int diff;


printf(" Enter the char with space : ");


if (scanf_s("%c%c%c", &A, &B, &C) != 3)
{
printf(" Input Error \n");
return(1);
}


if (A != 'B') // If second char dosn't space
{
printf("Error --> Characters are not separated by space \n");
return(1);
}


diff = A - C;


if (diff < 0) diff = C - A; // If the diff is negative.


printf("Difference is : %d \n", diff);


return(0);
}


פורסם

איך הבדיקה 'A != 'B בודקת אם התו האמצעי הוא רווח?

ארכיון

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

דיונים חדשים

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.