الحريـــري
17-Jan-2008, 09:27 PM
السلام عليكم ورحمة الله ..
الله يسعدكم بغيت مساعدتكم ,,
عندي برنامج حليته ببرنامج فجوال c++ وطلع فيه أخطاء بس مني عارفه أصححها ..
وهذا هو البرنامج وفيه ثلاث أخطاء اللي يعرفها يساعدني ضروري قبل يوم السبت ..
وشكراً مقدماً ..
write a function that moves the largest item on a given list to be the final node on the list
#include<iostream.h>
#include<math.h>
#include<stdlib.h>
typef struct node*link;
struct node{int item;
link next};
link move(link t,link x, link a);
main()
{int i,n=10;
struct node heada;
link a,i,larg,t,r;
a=&heada;
for(i=0,t=a;i<n;i++)
{t->next=malloc(siz eof*t);
t=t->next;
t->next=null;
t->item=rand()%100 0;}
for(t=a->next,t!=null;t= t->next)
cout<<"\n"<<t->item;
large=malloc(si zeof|*large);
large=malloc(si zeof*large();
large->item=0;
large->next=null;
r=move(t,large, a);
cout<<"the new list\n";
for(r=a->next;r!=null;r= r->next)
cout<<"\n"<<r->item;
}link move(linkt,link large,linka)
{
for(t=a->next;t!=null;t= t->next)
if(t->item>large->item)
large=t;
cout<<"the largest item:"<<large->next;
for(t=a->next;t!=null;t= t->next)
{
if(t->next-|>item==large->item)
t->next=t->next->next;
if(t->next==null)
}
t->next=large;
t->next->next=null;
}}
return t;
الله يسعدكم بغيت مساعدتكم ,,
عندي برنامج حليته ببرنامج فجوال c++ وطلع فيه أخطاء بس مني عارفه أصححها ..
وهذا هو البرنامج وفيه ثلاث أخطاء اللي يعرفها يساعدني ضروري قبل يوم السبت ..
وشكراً مقدماً ..
write a function that moves the largest item on a given list to be the final node on the list
#include<iostream.h>
#include<math.h>
#include<stdlib.h>
typef struct node*link;
struct node{int item;
link next};
link move(link t,link x, link a);
main()
{int i,n=10;
struct node heada;
link a,i,larg,t,r;
a=&heada;
for(i=0,t=a;i<n;i++)
{t->next=malloc(siz eof*t);
t=t->next;
t->next=null;
t->item=rand()%100 0;}
for(t=a->next,t!=null;t= t->next)
cout<<"\n"<<t->item;
large=malloc(si zeof|*large);
large=malloc(si zeof*large();
large->item=0;
large->next=null;
r=move(t,large, a);
cout<<"the new list\n";
for(r=a->next;r!=null;r= r->next)
cout<<"\n"<<r->item;
}link move(linkt,link large,linka)
{
for(t=a->next;t!=null;t= t->next)
if(t->item>large->item)
large=t;
cout<<"the largest item:"<<large->next;
for(t=a->next;t!=null;t= t->next)
{
if(t->next-|>item==large->item)
t->next=t->next->next;
if(t->next==null)
}
t->next=large;
t->next->next=null;
}}
return t;