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

פורסם

להלן התרגיל ->

http://www.f2h.co.il/7921574180945

הפתרון שאני כתבתי אך רק חציו עובד הפלט בסעיף ב לא עבד לי כראוי ואשמח לתיקון.



#include <stdio.h>
#include <string.h>


int main()
{
char str[70];
int i;
printf("enter Single char \n");
gets(str);
for(i=70;str[i]!='\0';i++)

if (str[i]>='a' && str[i]<='z'|| str[i]>='A' && str[i] <='Z')
break;
else
printf("%c",str[i]);
return 0;
}
/*
int str(char * word_appear, char * word_counter)
{
int i,index=0,wrdcnt=0;
while (str[i]!='\0')
index++;
wrdcnt++
printf("char appear %d, %d" index,wrdcnt) ;

} */
[code/]

פורסם

קודם כל, אתה חייב להקצות עבור המחרוזת מקום אחד יותר מהאורך המקסימלי שלה (כלומר לפחות 71 תווים) כדי להשאיר מקום ל-null terminator.

הלולאה שלך לא הגיונית - היא צריכה לאתחל את i ב-0, ולא ב-70.

לא הבנתי איך הפתרון שלך עובד, אין לך שום לולאה שבודקת שהקלט תקין (סעיף א').

ארכיון

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

דיונים חדשים

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.