Vcoderz Community
We create websites that have it all, beauty & brains
Lebanon Web Design & Development - Coddict
 

Go Back   Vcoderz Community > Computer Zone > Computers & Information Technologies

Notices

Computers & Information Technologies « Everything related to computers and internet. »

Reply
 
Share Thread Tools Search this Thread
Old 02-04-2007   #1
jadm
Registered Member
 
jadm's Avatar
 
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
Default plzzz i need help in c++

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


jadm is offline   Reply With Quote
Old 02-04-2007   #2
Charles
Registered Member
 
Charles's Avatar
 
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
Default Re: plzzz i need help in c++

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/
Attached Files
File Type: rar lc.rar (1.7 KB, 1 views)
Charles is offline   Reply With Quote
Old 02-04-2007   #3
Dazlingo
Registered Member
 
Dazlingo's Avatar
 
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
Default Re: plzzz i need help in c++

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];
Dazlingo is offline   Reply With Quote
Old 02-04-2007   #4
jadm
Registered Member
 
jadm's Avatar
 
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
Default Re: plzzz i need help in c++

tanx charles j'ai tout le cours mais le problem c que hayda l prog li katabto ma aam yozbat maae 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
jadm is offline   Reply With Quote
Old 02-04-2007   #5
Iceberg
Registered Member
 
Iceberg's Avatar
 
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
Default Re: plzzz i need help in c++

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
Iceberg is offline   Reply With Quote
Old 02-04-2007   #6
jadm
Registered Member
 
jadm's Avatar
 
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
Default Re: plzzz i need help in c++

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 :P
li bya3irfo lal program 2ilo 100 $ :P lol
jadm is offline   Reply With Quote
Old 02-04-2007   #7
Iceberg
Registered Member
 
Iceberg's Avatar
 
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
Default Re: plzzz i need help in c++

Quote:
Originally Posted by jadm
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 :P
li bya3irfo lal program 2ilo 100 $ :P lol
Suits you, tables or not I still say you should read tutorials (millions available on the web) and you will find it's very easy and simple to create linked lists and adds them up, it's all about arrays.
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.
Iceberg is offline   Reply With Quote
Old 02-04-2007   #8
jadm
Registered Member
 
jadm's Avatar
 
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
Default Re: plzzz i need help in c++

// 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
jadm is offline   Reply With Quote
Old 02-04-2007   #9
Dazlingo
Registered Member
 
Dazlingo's Avatar
 
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
Default Re: plzzz i need help in c++

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));
    }    
};
for the use of it:
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);
do the addittion:

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 ();
    }
and finally the print:

Code:
    t3=&L3;
    for (i=0;i<4;i++)
    {
        cout << "Value " << i << " : " << t3->getVal () << endl;
        t3=t3->getNext ();
    }
im just in a good mood today, so i wrote this thingy. it's working


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
Dazlingo is offline   Reply With Quote
Old 02-04-2007   #10
jadm
Registered Member
 
jadm's Avatar
 
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
Default Re: plzzz i need help in c++

tanx dazlingo kinit 3am nabish 3a gheir shi bass anyway zabatit ma3e 3al tari2a li 3titne yeha (Y) ur the mannn
jadm is offline   Reply With Quote
Reply

  Vcoderz Community > Computer Zone > Computers & Information Technologies

Tags
plzzz



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT +1. The time now is 12:43 AM.


Lebanon web design and development
Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Share