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

פורסם

מה שהבנתי סימנתי אשמח להסבר מה יהיה הפלט ולמה?

#include <iostream.h>

#include <string.h>



class myThis

{

char s;

static char d;

public:

myThis(char* a,int i)

{

if( i>=0 && i<strlen(a)) s=a[i]; //index of array stat from 0

else s='0';

d++;

}



myThis& och() //

{

s++;

d++;

return *this; //return obecjt

}

void print()

{ cout<<s<<" "<<d<<endl;}



};



char myThis:='A'; //mythis-class ,d=misthna static



void main()

{

char* h="Michlala"; // pointer to michlala

myThis mt(h,2),mt1(h,2); //



mt.och().och().print();

mt1.och().och().print();

mt.print();

}



פורסם

טוב , בעיקרון אתה צריך לשים לב שהמשתנה הסטטי שמאותחל ל A עולה כל פעם שקוראים לקונסטרקטור , כלומר פעמיים עבור mt ו mt1, כמו כן עבור כל אובייקט בניפרד השדה הפנימי s מאותחל לפי האינדקס שהוא מקבל - במקרה שלנו - c .

קריאות ל och עבור mt יקדמו את mt.s ואת A פעמיים וכנ"ל עבור mt1.s ו A

קריאה אחרונ ל mt.print פשוט תדפיס את mt.s הקיבלת בהתחלה עם המשתנה הסטאטי המעודכן.

מקווה שעזרתי

ארכיון

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

דיונים חדשים

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.