Isus Hristos e edno I edinstveno ime dadeno pod neboto vo koi lugjeto bi mozele da bidat Spaseni, zošto on e Gospod I Bog I Spasitel, poveruvajte vo nego. Poveruvajte 1 Korintjani 15gl 1 do 4st; Biblija Nov Zavet. Seta Slava I Fala pripada nemu.
#include<iostream> using namespace std; struct node { int data; node *next; }; void prikazi_lista(node *pok) { if(pok==NULL)
cout<<"List is empty.n"; else { while( pok!=NULL ) { cout<<pok->data<<" "; // show the data in the linked list pok=pok->next; // tranfer the address of 'temp->next' to 'temp' } } } int main() { int broj; node *temp; //temporary node *temp1; //temporary node *head=NULL; //se kreira prazna lista (empty linked list) prikazi_lista(head); cout<<endl; cout<<"Vnesuvanje element NA POCETOKOT OD LISTATA"<<endl; temp=(node*)malloc(sizeof(node)); //allocate space for node cout<<"Vnesete cel broj: ";cin>>broj; temp->data=broj; temp->next=head; head=temp; //prikazuvanje na listata cout<<"Posle dodavanjeto na elementot, listata izgleda vaka:"<<endl; prikazi_lista(head); cout<<endl<<endl; cout<<"Vnesuvanje element NA KRAJOT OD LISTATA"<<endl; temp=(node*)malloc(sizeof(node)); // allocate space for node temp1=head; // transfer the address of 'head' to 'temp1' while(temp1->next!=NULL) // go to the last node temp1=temp1->next; //tranfer the address of 'temp1->next' to 'temp1' cout<<"Vnesete cel broj: ";cin>>broj; temp->data=broj; // store data(first field) temp->next=NULL; // second field will be null(last node) temp1->next=temp; // 'temp' node will be the last node cout<<"Posle dodavanjeto na elementot, listata izgleda vaka:"<<endl; prikazi_lista(head); cout<<endl<<endl; cout<<"Vnesuvanje element POSLE ODREDEN BROJ NA JAZLI."<<endl; int node_number; cout<<"ENTER THE NODE NUMBER:"; cin>>node_number; // take the node number from user temp1=(node*)malloc(sizeof(node)); // allocate space for node temp1=head; for(int i=1;i<node_number;i++) { temp1=temp1->next; // go to the next node if(temp1==NULL) { cout<<node_number<<" node is not exist"<< endl; break; } } temp=(node*)malloc(sizeof(node)); // allocate space for node cout<<"Vnesete cel broj: ";cin>>broj; temp->data=broj; // store data(first field) temp->next=temp1->next; //transfer the address of temp1->next to temp->next temp1->next=temp; //transfer the address of temp to temp1->next cout<<"Sega listata izgleda vaka:"<<endl; prikazi_lista(head); cout<<endl<<endl; cout<<"BRISENJE ELEMENT NA POCETOKOT NA LISTATA"<<endl; temp=(node*)malloc(sizeof(node)); // allocate space for node temp=head; // transfer the address of 'head' to 'temp' head=temp->next; // transfer the address of 'temp->next' to 'head' free(temp); cout<<"Posle brisenjeto na prviot element, listata izgleda vaka:"<<endl; prikazi_lista(head); cout<<endl<<endl; cout<<"BRISENJE ELEMENT NA KRAJOT NA LISTATA"<<endl; temp1=(node*)malloc(sizeof(node)); // allocate space for node temp1=head; //transfer the address of head to temp1 node *old_temp; // create a temporary node old_temp=(node*)malloc(sizeof(node)); // allocate space for node while(temp1->next!=NULL) // go to the last node { old_temp=temp1; // transfer the address of 'temp1' to 'old_temp' temp1=temp1->next; // transfer the address of 'temp1->next' to 'temp1' } old_temp->next = NULL; // previous node of the last node is null free(temp1); cout<<"Posle brisenjeto na posledniot element, listata izgleda vaka:"<<endl; prikazi_lista(head); cout<<endl<<endl; system("pause"); return 0; }
Коментарите се затворени.
2024 – All Right Reserved. Designed and Developed byinfobiro
11 коментари
Леле, Сергеј, подкастот беше многу интересен. Ти навистина беше одличен вечерва и од срце уживав додека те слушав.
Филип беше вистинска инспирација – секоја чест за неговите 26 години и за сè што досега има постигнато. Толку млад, а толку зрел и успешен.
Филип, внимавај на себе и немој премногу да лудуваш – пред тебе е долг живот полн со можности, радости и убави моменти.
Од срце ти посакувам здравје, мир и среќа. Господ да те чува и да ти даде сè што посакуваш, љубов во домот и еден куп дечиња. 🤍🙏
Поздрав од Сузана
Господ да те чува дете мило 🙏
IZLET 2.0 coming soon
Prekrasno dete,gazi filip i stigni do vrvot sekako po koj pat i da odis gi imas site kvaliteti
Sekogas na nivo i Sergej i gostite sekoja cest❤
Точно Сергеј, ама ова тло е унија на малограѓанство, беспарица и завидливост.
Одличен поткаст, одличен гостин, Сергеј секогаш на ниво.
Isus Hristos e edno I edinstveno ime dadeno pod neboto vo koi lugjeto bi mozele da bidat Spaseni, zošto on e Gospod I Bog I Spasitel, poveruvajte vo nego. Poveruvajte 1 Korintjani 15gl 1 do 4st; Biblija Nov Zavet. Seta Slava I Fala pripada nemu.
Многу убав пар сте😊
O va dete neDete zlatoo e duki mir boZji
#include<iostream>
using namespace std;
struct node
{
int data;
node *next;
};
void prikazi_lista(node *pok)
{
if(pok==NULL)
cout<<"List is empty.n";
else
{
while( pok!=NULL )
{
cout<<pok->data<<" "; // show the data in the linked list
pok=pok->next; // tranfer the address of 'temp->next' to 'temp'
}
}
}
int main()
{
int broj;
node *temp; //temporary
node *temp1; //temporary
node *head=NULL; //se kreira prazna lista (empty linked list)
prikazi_lista(head);
cout<<endl;
cout<<"Vnesuvanje element NA POCETOKOT OD LISTATA"<<endl;
temp=(node*)malloc(sizeof(node)); //allocate space for node
cout<<"Vnesete cel broj: ";cin>>broj;
temp->data=broj;
temp->next=head;
head=temp;
//prikazuvanje na listata
cout<<"Posle dodavanjeto na elementot, listata izgleda vaka:"<<endl;
prikazi_lista(head);
cout<<endl<<endl;
cout<<"Vnesuvanje element NA KRAJOT OD LISTATA"<<endl;
temp=(node*)malloc(sizeof(node)); // allocate space for node
temp1=head; // transfer the address of 'head' to 'temp1'
while(temp1->next!=NULL) // go to the last node
temp1=temp1->next; //tranfer the address of 'temp1->next' to 'temp1'
cout<<"Vnesete cel broj: ";cin>>broj;
temp->data=broj; // store data(first field)
temp->next=NULL; // second field will be null(last node)
temp1->next=temp; // 'temp' node will be the last node
cout<<"Posle dodavanjeto na elementot, listata izgleda vaka:"<<endl;
prikazi_lista(head);
cout<<endl<<endl;
cout<<"Vnesuvanje element POSLE ODREDEN BROJ NA JAZLI."<<endl;
int node_number;
cout<<"ENTER THE NODE NUMBER:";
cin>>node_number; // take the node number from user
temp1=(node*)malloc(sizeof(node)); // allocate space for node
temp1=head;
for(int i=1;i<node_number;i++)
{
temp1=temp1->next; // go to the next node
if(temp1==NULL)
{
cout<<node_number<<" node is not exist"<< endl;
break;
}
}
temp=(node*)malloc(sizeof(node)); // allocate space for node
cout<<"Vnesete cel broj: ";cin>>broj;
temp->data=broj; // store data(first field)
temp->next=temp1->next; //transfer the address of temp1->next to temp->next
temp1->next=temp; //transfer the address of temp to temp1->next
cout<<"Sega listata izgleda vaka:"<<endl;
prikazi_lista(head);
cout<<endl<<endl;
cout<<"BRISENJE ELEMENT NA POCETOKOT NA LISTATA"<<endl;
temp=(node*)malloc(sizeof(node)); // allocate space for node
temp=head; // transfer the address of 'head' to 'temp'
head=temp->next; // transfer the address of 'temp->next' to 'head'
free(temp);
cout<<"Posle brisenjeto na prviot element, listata izgleda vaka:"<<endl;
prikazi_lista(head);
cout<<endl<<endl;
cout<<"BRISENJE ELEMENT NA KRAJOT NA LISTATA"<<endl;
temp1=(node*)malloc(sizeof(node)); // allocate space for node
temp1=head; //transfer the address of head to temp1
node *old_temp; // create a temporary node
old_temp=(node*)malloc(sizeof(node)); // allocate space for node
while(temp1->next!=NULL) // go to the last node
{
old_temp=temp1; // transfer the address of 'temp1' to 'old_temp'
temp1=temp1->next; // transfer the address of 'temp1->next' to 'temp1'
}
old_temp->next = NULL; // previous node of the last node is null
free(temp1);
cout<<"Posle brisenjeto na posledniot element, listata izgleda vaka:"<<endl;
prikazi_lista(head);
cout<<endl<<endl;
system("pause");
return 0;
}
Коментарите се затворени.