:SnipeR (82):
:Copy of 7anoon:
عرض للطباعة
:SnipeR (82):
:Copy of 7anoon:
:SnipeR (35):
احكو حكي مفيد او اسكتو
#include<iostream.h>
#include<stdlib.h>
#include "list.h"
list::list()
{
length=0;
listdata=NULL;
}
/*void list::makeEmpty()
{
length=0;
listdata=0;
}*/
bool list::isFull()const
{
node *********;
**********new node;
if(**********=0)
return true;
else
return false;
delete ********;
}
bool list::isEmpty()const
{
return (listdata==0);
}
void list::insertfirst(int item)
{
if(isFull())
{
cout<<"the memorey is full \n";
exit(1);
}
else
{
node * ********;
**********new node;
********->item=item;
********->next=listdata;
listdata**********;
length++;
}
}
void list::insertlast(int item)
{
node *********;
**********new node;
********->item=item;
length++;
if(listdata==NULL)
{
listdata**********;
}
else
{
cpostion=listdata;
while(cpostion->next != NULL)
{
cpostion=cpostion->next;
}
cpostion->next**********;
}
}
void list::insertafter(int i,int item)
{
if(isFull())
{
cout<<"the memorey is full \n";
exit(1);
}
node * ********;
**********new node;
********->item=item;
length++;
if(listdata==NULL)
{
********->next=listdata;
listdata**********;
}
else
{
cpostion=listdata;
while(cpostion->next!=0&&cpostion->item!=i)
{
cpostion=cpostion->next;
}
if(cpostion->next==0)
cpostion->next**********;
else
{
********->next=cpostion->next;
cpostion->next**********;
}
}
}
int list::getlength()
{
return length;
}
int list::deleteItemfirst()
{
if(isEmpty())
{
cout<<"the list is emptey \n";
exit(1);
}
length--;
int x=listdata->item;
cpostion=listdata;
listdata=listdata->next;
delete cpostion;
return x;
}
int list::deleteItemlast()
{
if(isEmpty())
{
cout<<"the list is emptey \n";
exit(1);
}
length--;
cpostion=listdata;
while((cpostion->next)->next!=NULL)
{
cpostion->next=(cpostion->next)->next;
}
int x=(cpostion->next)->item;
delete cpostion->next;
return x;
}
void list::deleteItemvalue(int v)
{
if(isEmpty())
{
cout<<"the list is emptey \n";
exit(1);
}
cpostion=listdata;
while(cpostion->next!=0&&cpostion->item!=v)
{
cpostion=cpostion->next;
}
if(cpostion->next==0)
{
cout<<" the "<<v<<"not found";
exit(1);
}
else
{
node * ********;
**********new node;
**********cpostion;
cpostion=cpostion->next;
delete ********;
}
}
void list::print()
{
node *********;
**********listdata;
while(******** != NULL)
{
cout<<********->item;
******************->next;
}
}
void list::deleteX(int z)
{
node *p,*q, *temploc;
p=listdata;
q=NULL;
if(listdata==NULL)
{
cout<<"the list is empty";
exit(0);
return;
}
else{
if(p->item==z)
{
q=p;
p = p->next ;
delete q;
length--;
}
while(p != NULL){
if(p->item == z){
q->next = p->next;
temploc = p ;
p = p->next ;
delete temploc;
length--;
}
else{
q = p;
p = p->next ;
}
}
}
}
يا الله استفيدوا:SnipeR (19)::SnipeR (19):
اقتباس:
المشاركة الأصلية كتبت بواسطة shatnawi_king_CS http://al79n.com/vb/images/styles/bl...s/viewpost.gif
#include<iostream.h>
#include<stdlib.h>
#include "list.h"
list::list()
{
length=0;
listdata=NULL;
}
/*void list::makeEmpty()
{
length=0;
listdata=0;
}*/
bool list::isFull()const
{
node *********;
**********new node;
if(**********=0)
return true;
else
return false;
delete ********;
}
bool list::isEmpty()const
{
return (listdata==0);
}
void list::insertfirst(int item)
{
if(isFull())
{
cout<<"the memorey is full \n";
exit(1);
}
else
{
node * ********;
**********new node;
********->item=item;
********->next=listdata;
listdata**********;
length++;
}
}
void list::insertlast(int item)
{
node *********;
**********new node;
********->item=item;
length++;
if(listdata==NULL)
{
listdata**********;
}
else
{
cpostion=listdata;
while(cpostion->next != NULL)
{
cpostion=cpostion->next;
}
cpostion->next**********;
}
}
void list::insertafter(int i,int item)
{
if(isFull())
{
cout<<"the memorey is full \n";
exit(1);
}
node * ********;
**********new node;
********->item=item;
length++;
if(listdata==NULL)
{
********->next=listdata;
listdata**********;
}
else
{
cpostion=listdata;
while(cpostion->next!=0&&cpostion->item!=i)
{
cpostion=cpostion->next;
}
if(cpostion->next==0)
cpostion->next**********;
else
{
********->next=cpostion->next;
cpostion->next**********;
}
}
}
int list::getlength()
{
return length;
}
int list::deleteItemfirst()
{
if(isEmpty())
{
cout<<"the list is emptey \n";
exit(1);
}
length--;
int x=listdata->item;
cpostion=listdata;
listdata=listdata->next;
delete cpostion;
return x;
}
int list::deleteItemlast()
{
if(isEmpty())
{
cout<<"the list is emptey \n";
exit(1);
}
length--;
cpostion=listdata;
while((cpostion->next)->next!=NULL)
{
cpostion->next=(cpostion->next)->next;
}
int x=(cpostion->next)->item;
delete cpostion->next;
return x;
}
void list::deleteItemvalue(int v)
{
if(isEmpty())
{
cout<<"the list is emptey \n";
exit(1);
}
cpostion=listdata;
while(cpostion->next!=0&&cpostion->item!=v)
{
cpostion=cpostion->next;
}
if(cpostion->next==0)
{
cout<<" the "<<v<<"not found";
exit(1);
}
else
{
node * ********;
**********new node;
**********cpostion;
cpostion=cpostion->next;
delete ********;
}
}
void list::print()
{
node *********;
**********listdata;
while(******** != NULL)
{
cout<<********->item;
******************->next;
}
}
void list::deleteX(int z)
{
node *p,*q, *temploc;
p=listdata;
q=NULL;
if(listdata==NULL)
{
cout<<"the list is empty";
exit(0);
return;
}
else{
if(p->item==z)
{
q=p;
p = p->next ;
delete q;
length--;
}
while(p != NULL){
if(p->item == z){
q->next = p->next;
temploc = p ;
p = p->next ;
delete temploc;
length--;
}
else{
q = p;
p = p->next ;
}
}
}
}
مع انه انا خبصت فيها الlist بس حلوة
اكيد رج يجيك اكتب friend function بعمل ابصر شو عليها
انتو المادة عندكم عكس عنا
طيب انت شو امتحنتو فيرست ؟؟
اقتباس:
المشاركة الأصلية كتبت بواسطة shatnawi_king_CS http://al79n.com/vb/images/styles/bl...s/viewpost.gif
الستاك والكيو :eh_s(2)::eh_s(2):
والسكند list
والله اعلم شو على الفاينال غير TREE
عندكم عكس عنا تمام
بتبدو من السهل للصعب ... احنا من الصعب للسهل
والفاينال بدها تكون ما بعرف شو لسه ما اخدت ولا محاضرة على الفاينال
انت بكرة امتحانك ؟
سلالالالالالالالالالالالالام مربع للجيمع