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

פורסם
  • מחבר

temp שבתכנית הראשית אמורה לקבל את מה שהפונקציה מחזירה.(return temp)

  • תגובות 35
  • צפיות 3.8k
  • נוצר
  • תגובה אחרונה

משתתפים בולטים בדיון

פורסם

אבל מה בתכלס נשאר לך שם אחרי הקריאה(לא מה צריך להיות)?

עריכה:



//תרגיל 3: פונקציה המחזירה רשימה ברוורס
#include <iostream>
#include <conio.h>
#include "Link.h"
#include "List.h"
using namespace std;
template <class T>
void Revers(List<T> list, List<T> &temp)
{

while(!list.IsEmpty())
{
temp.Add(list.RemoveFirst());
}

}

void main()
{

List<int>list,temp;
int i=0;

while(i<9)//הצבת ערכים ברשימה
{
list.Add(i*2+5);
i++;
}
cout<<"list is: ";
list.print();//הדפסת הרשימה

Revers(list,temp);//קריאה לפונקציה להפיכת הרשימה
cout<<"\n\nlist revers is: ";
temp.print();//הדפסת הרשימה ההפוכה

getche();
}
/*

*/


מה יש לך בTEM אחרי קריאת הפונ?

פורסם
  • מחבר

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

לא הבנתי מה שינת שם מלבד זה שהתכנית פועלת?????? אפשר הסבר???

תודה.

פורסם

התוכנית פועלת?(שאלה)

בסך הכל שיניתי את הערך שהפונ מחזירה ל- VOID(את הTEMP החזרתי דרך הפרמטרים ע"י REF), ואת סוג הפרמטר הראשון שהפונ מקבלת(הורדתי את הרפרנס שלו, אך סביר להניח שהתוכנית לא עובדת בגלל זה).

פורסם
  • מחבר

התכנית פועלת מ-צ-ו-י-ן!!!!!!!!!!!!!! :yelclap: :yelclap: :yelclap: :yelclap:

תודה רבה!!!!!!!!!!!

->עדיין לא הבנתי מה פשר השינוי(אם אפשר הסבר ברור יותר)

ושוב-תודה.

פורסם


void Revers(List<T> list, List<T> &temp)

במקום:


List<T> Revers(List<T> &list, List<T> &temp)

הרשימה החדשה חוזרת BY REF מהפרמטרים של הפונ. הרשימה הישנה נשלחת BY VAL כדי לא לפגוע בה בתוך הMAIN.

ארכיון

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

דיונים חדשים

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.