Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- struct node{
- int heso;
- int somu;
- node*pNext;
- };
- struct list{
- node*pHead;
- int size;
- };
- list*ConvertTolinkerList(int *arr, int size){
- list *l=new list;
- node*a;
- int i=0;
- l->pHead->heso=arr[0];
- while(i!=size){
- a=new node;
- a=l->pHead->pNext;
- a->heso=arr[i];
- while(a->pNext!=NULL){
- l->pHead=a;
- }
- }
- }
- void Print(list*&l){
- while(l->pHead->pNext!=NULL){
- cout << l->pHead->heso;
- l->pHead=l->pHead->pNext;
- }
- }
- int main(){
- int arr[5]={3,4,5,6,5};
- list*linkerlist=ConvertTolinkerList(arr,5);
- Print(linkerlist);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement