
14-02-2007, 17:34
|
|
|
|
חבר מתאריך: 04.11.06
הודעות: 18
|
|
בעיות קומפילציה בנושא רשימה(List) בשפת c
אשמחח אם תעזרו לי בבעיות שהתגלו ובעבודה עם המיקום של הרשימה(p1,p2,p3)
צירפתי את קבצי המקור בראר
אני יודע שלא השתמשתי נכון בפונקציה, אשמח אם תתקנו אותי
הכוונה שלי:
לאתחל שני רשימות L1 ו L2 - לבנות אותם מהתחלה ושיהיו בהם ערכים
והפונקציה מזג_רשימות(L1,L2) תמזג בניהם בהתאמה, תכניס את L2 אחרי L1 (שירשור)
הקוד של התכנית הראשית (פה הבעיות):
קוד:
#include <stdio.h>
#include "listD.h"
int main()
{
list_type L1,L2;
list_build(&L1);
list_build(&L2);
pour_list(L1,L2)
{
list_info_type x,y;
list_type L1,L2,L3;
pos_type p1,p2,p3;
p1=list_next(L1,list_anchor(L1));
p2=list_next(L2,list_anchor(L2));
list_init(&l3);
p3=list_anchor(L3);
while (p1!=list_end(L1)&&p2!=list_end(L2))
{
list_retrieve(L1,P1,&x);
list_retrieve(L2,P2,&y);
if(x<y)
{
list_insert(&L3,P3,x);
p1=list_next(L1,P1);
p3=list_next(L3,P3);
}
else if(y<x)
{
list_insert(&L3,P3,y);
p2=list_next(L2,P2);
p3=list_next(L3,P3);
else{
list_insert(&L3,p3,x);
p1=list_next(L1,P1);
p2=list_next(L2,P2);
p3=list_next(L3,P3);
}
if(p1==list_end(L1))
{
while(p2!=list_end(L2))
{
list_retrieve(L2,P2,&y);
list_insert(L3,p3,y);
p2=list_next(L2,P2);
p3=list_next(L3,P3);
}
}
else while(P1!=list_end(L1))
{
list_retrieve(L1,P1,&y);
list_insert(L3,p3,y);
p1=list_next(L1,P1);
p3==list_next(L3,P3);
}
return L3;
}
return 0;
}
קבצי המקור:
https://2007-uploaded.fresh.co.il/2...14/66992899.rar
נערך לאחרונה ע"י Ch00k בתאריך 14-02-2007 בשעה 17:38.
|