|
|
|||||||
| Computers & Information Technologies « Everything related to computers and internet. » |
![]() |
|
|
Share | Thread Tools | Search this Thread |
|
|
#1 |
|
Registered Member
Last Online: 07-21-2009
Join Date: Jan 2007
Posts: 138
Thanks: 60
Thanked 22 Times in 21 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
hey guys
its my first thread here and i wich someone could help me i saw the thread of general rami about writing a prog in c++ i have an exercice if someone could help me with : i will type it in frensh il ya deux liste chainee qu'on les a crees et les remplir, puis on doit cree une troisieme liste chainee et mettre l'addition des deux liste qu'on a cree dans le troiseme for example: la premiere liste chainee contient: 5 - 8 - 3 - 4 la deuxieme liste chainee contient : 2 - 1 - 6 - 7 on doit cree une troisieme liste chainee et quontient l'addition des 2 liste precedente donc la 3=eme doit contenir : 7 - 9 - 9 - 11 // 7 car 5 + 2 // 9 car 8 + 1 // 9 car 6 + 3 // 11 car 7 + 4 BTW liste chainee simple pas double if someone know how to do it in both simple and double it will be great tanx , waiting for a reply |
|
|
|
|
|
#2 |
|
Registered Member
Last Online: 08-27-2008
Join Date: Sep 2006
Posts: 75
Thanks: 0
Thanked 0 Times in 0 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
voila je t'nvoie un lien pour un petit resume sur les listes chainees, et un exemple de liste chainee que j'ai fait pour mon projet l'annee derniere.
et comme tu essayes de le faire. bon courage http://chgi.developpez.com/pile/ http://nicolasj.developpez.com/articles/listedouble/ |
|
|
|
|
|
#3 |
|
Registered Member
Last Online: 12-13-2007
Join Date: Jan 2007
Posts: 51
Thanks: 0
Thanked 3 Times in 2 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
lol !!!
bah goes like this i guess Code:
int list1[]={5,8,3,4};
int list2[]={2,1,6,7};
int list3[4];
for (int i=0;i<4;i++)
list3[i]=list1[i]+list2[i];
|
|
|
|
|
|
#4 |
|
Registered Member
Last Online: 07-21-2009
Join Date: Jan 2007
Posts: 138
Thanks: 60
Thanked 22 Times in 21 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
tanx charles
kassarit l pc w ma aam yozbat lol dazlingo thats not liste chainee hole li katabtoun inta tableaux mich liste chainee tanx anyway damn my final exam tuesday chabeb btinzalo nwali3 dwelib tuesday? :P
|
|
|
|
|
|
#5 |
|
Registered Member
Last Online: 07-06-2012
Join Date: Jan 2007
Posts: 120
Thanks: 0
Thanked 51 Times in 33 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
What dazlingo wrote is approximatively correct, where do you see a table? You sure you're studying C++?
Creating a linked list and adding 2 lists together in a third can be done in a few lines, how do you expect to learn if we do it for you? This is the basic, what will you do when you get to MFCs? (if ever..)
__________________
Abusing Tha Power |
|
|
|
|
|
#6 |
|
Registered Member
Last Online: 07-21-2009
Join Date: Jan 2007
Posts: 138
Thanks: 60
Thanked 22 Times in 21 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
iceberggg hole li kataboun dazlingo ismoun tableauxxx l liste chainee ya3ne bi koun fiya structures w head->data w head->next w pointeurs w malyoun 2alif chaghle houwe li kataboune mazboutin bil tableaux mich bil liste chainee
nzalo nwali3 dwelib l tuesday bi charafkoun :Pli bya3irfo lal program 2ilo 100 $ :P lol |
|
|
|
|
|
#7 | |
|
Registered Member
Last Online: 07-06-2012
Join Date: Jan 2007
Posts: 120
Thanks: 0
Thanked 51 Times in 33 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
Quote:
I would help with syntax problems and things missing, but writing a whole program for you that is simplistic would make you accomplish nothing, you have to learn.
__________________
Abusing Tha Power Last edited by Iceberg; 02-04-2007 at 10:18 AM. |
|
|
|
|
|
|
#8 |
|
Registered Member
Last Online: 07-21-2009
Join Date: Jan 2007
Posts: 138
Thanks: 60
Thanked 22 Times in 21 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
// n = longueur du premiere liste;
// m = longueur de deuxieme liste; // l = longueur du troisieme liste; //head = tab3oul l premiere liste; // head 1 = tab3oul l deuxieme liste; // head 2 = 3 =eme liste; node *create2(node*head2,node*head1,node*head,int n,int m){ int l,i; node * cur=head; node*cur1=head1; node*tmp; node*last; last=new node; last->data=cur->data+cur1->data; head2=last; if (m>=n) l=m; if (n>m) l=n; /// pour savoir la longueur du troisieme liste for(i=0;i<l;i++){ tmp=new node; cur=cur->next; cur1=cur1->next; tmp->data=cur1->data+cur->data; last->next=tmp; last=tmp; } last->next=NULL; return head2; } if anyone could tell me where is the problem bkoun mamnounnnnnnn 3am bi 7hotile the prog has encountered a problem and needs to close. We are sorry for the inconvenience. debug or close .... so ya3ne fi mashkal bil prog bass ma 3am ba3rif shou houwe
|
|
|
|
|
|
#9 |
|
Registered Member
Last Online: 12-13-2007
Join Date: Jan 2007
Posts: 51
Thanks: 0
Thanked 3 Times in 2 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
lol, list chainee.... loooooooooooooooooooooooooooooooooooooool
man where the node is defined ??? anyway i am WITH Iceberg, but im too bored right now, so i thought id write smth up. im not gonna comment the code (ba3ed na'is :P) class definition Code:
class node
{
private:
node *next;
int value;
public:
node(){next=NULL;}
node(int v){next=NULL;value=v;}
void setNext(node *n){next=n;}
node* getNext(){return next;}
int getVal(){return value;}
void setVal(int v){value=v;}
void insertNode(int v)
{
node *p=this;
while(p->getNext ()!=NULL)
p=p->getNext();
p->setNext(new node(v));
}
};
how u can fill it Code:
node L1(5), L2(2);
L1.insertNode (8);
L1.insertNode (3);
L1.insertNode (4);
L2.insertNode (1);
L2.insertNode (6);
L2.insertNode (7);
Code:
node L3;
node *t1=&L1;
node *t2=&L2;
node *t3=&L3;
for (int i=0;i<4;i++)
{
t3->setVal (t1->getVal () + t2->getVal ());
t3->setNext (new node);
t3=t3->getNext ();
t1=t1->getNext ();
t2=t2->getNext ();
}
Code:
t3=&L3;
for (i=0;i<4;i++)
{
cout << "Value " << i << " : " << t3->getVal () << endl;
t3=t3->getNext ();
}
AND LEARN TO DEBUG !!!!!! u wont go far without it edit: you need the double ? go do it :P should be REALLY easy with the code above. Last edited by Jean; 02-04-2007 at 05:32 PM. Reason: bad words are not allowed |
|
|
|
|
|
#10 |
|
Registered Member
Last Online: 07-21-2009
Join Date: Jan 2007
Posts: 138
Thanks: 60
Thanked 22 Times in 21 Posts
Groans: 0
Groaned at 0 Times in 0 Posts
|
tanx dazlingo kinit 3am nabish 3a gheir shi
bass anyway zabatit ma3e 3al tari2a li 3titne yeha (Y) ur the mannn |
|
|
|
![]() |
|
| Tags |
| plzzz |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| hello guys i need rainbow songs plzzz | The Lizard King | The Multimedia Room | 4 | 11-07-2006 10:26 PM |
| i need a song!!! plzzz | karo7 | The Multimedia Room | 5 | 10-24-2006 04:14 PM |