SlideShare a Scribd company logo
#include
struct node
{
char value;
struct node *next;
};
class StringOfNode
{
struct node * head;
public:
StringOfNode()
{
head=NULL;
}
int size()
{
struct node *p=head;
int count=1;
while(p)
{
count++;
p=p->next;
}
return count;
}
struct node * begin()
{
return head;
}
char &operator[](int index)
{
int i=0;
struct node *p=head;
while(index!=i)
{
p=p->next;
i++;
}
return p->value;
}
void insertFront(char valuee)
{
struct node * temp=(struct node *)malloc(sizeof(struct node));
temp->value=valuee;
temp->next=NULL;
if(head==NULL)
head=temp;
else
{
temp->next=head;
head=temp;
}
}
void insert(char valuee, int pos)
{
struct node *p=head;
struct node * temp=(struct node *)malloc(sizeof(struct node));
temp->value=valuee;
temp->next=NULL;
int i=0;
if(p==NULL)
{
head=temp;
}
else
{
while(i!=pos-1)
{
p=p->next;
i++;
}
temp->next=p->next;
p->next=temp;
}
}
void insertBack(char valuee)
{
struct node *p=head;
struct node * temp=(struct node *)malloc(sizeof(struct node));
temp->value=valuee;
temp->next=NULL;
if(p==NULL)
{
head=temp;
}
else
{
while(p->next!=NULL)
p=p->next;
p->next=temp;
}
}
void print()
{
struct node *p=head;
while(p)
{
std::cout<value<<" ";
p=p->next;
}
}
StringOfNode operator+(const StringOfNode& b)
{
StringOfNode *S;
struct node *p=head;
while(p->next!=NULL)
p=p->next;
p->next=S->begin();
}
};
int main()
{
StringOfNode *p1=new StringOfNode;
p1->insertBack('b');
p1->insertBack('c');
p1->insertBack('e');
p1->insert('d',2);
p1->insertFront('a');
p1->print();
system("pause");
return 0;
}
Solution
#include
struct node
{
char value;
struct node *next;
};
class StringOfNode
{
struct node * head;
public:
StringOfNode()
{
head=NULL;
}
int size()
{
struct node *p=head;
int count=1;
while(p)
{
count++;
p=p->next;
}
return count;
}
struct node * begin()
{
return head;
}
char &operator[](int index)
{
int i=0;
struct node *p=head;
while(index!=i)
{
p=p->next;
i++;
}
return p->value;
}
void insertFront(char valuee)
{
struct node * temp=(struct node *)malloc(sizeof(struct node));
temp->value=valuee;
temp->next=NULL;
if(head==NULL)
head=temp;
else
{
temp->next=head;
head=temp;
}
}
void insert(char valuee, int pos)
{
struct node *p=head;
struct node * temp=(struct node *)malloc(sizeof(struct node));
temp->value=valuee;
temp->next=NULL;
int i=0;
if(p==NULL)
{
head=temp;
}
else
{
while(i!=pos-1)
{
p=p->next;
i++;
}
temp->next=p->next;
p->next=temp;
}
}
void insertBack(char valuee)
{
struct node *p=head;
struct node * temp=(struct node *)malloc(sizeof(struct node));
temp->value=valuee;
temp->next=NULL;
if(p==NULL)
{
head=temp;
}
else
{
while(p->next!=NULL)
p=p->next;
p->next=temp;
}
}
void print()
{
struct node *p=head;
while(p)
{
std::cout<value<<" ";
p=p->next;
}
}
StringOfNode operator+(const StringOfNode& b)
{
StringOfNode *S;
struct node *p=head;
while(p->next!=NULL)
p=p->next;
p->next=S->begin();
}
};
int main()
{
StringOfNode *p1=new StringOfNode;
p1->insertBack('b');
p1->insertBack('c');
p1->insertBack('e');
p1->insert('d',2);
p1->insertFront('a');
p1->print();
system("pause");
return 0;
}

More Related Content

Similar to #includeiostream struct node {    char value;    struct no.pdf (20)

PPT
Doublylinklist
ritu1806
 
PDF
C++ Program to Implement Singly Linked List #includeiostream.pdf
angelsfashion1
 
PPT
Linked lists
GowriKumar Chandramouli
 
PDF
linked listLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.pdf
minorproject456
 
PPTX
Singly linked list program in data structure - Vtech
Vtech Academy of Computers
 
DOC
Ds 2 cycle
Chaitanya Kn
 
PDF
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
forladies
 
PDF
i nsert+in+ link list
EAJAJAhamed
 
DOCX
Linked list imp of list
Elavarasi K
 
PPTX
Singly linked list.pptx
Santhiya S
 
PPTX
DSA(1).pptx
DaniyalAli81
 
PDF
C++Write a function void headEnqueue(Queue q, int key) which enqu.pdf
arjuncp10
 
PDF
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
FOREVERPRODUCTCHD
 
PDF
Double linked list header file below for FYI#include iostream.pdf
facevenky
 
PDF
In C++ I need help with this method that Im trying to write fillLi.pdf
fantoosh1
 
PDF
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
pasqualealvarez467
 
DOCX
Data structure lab on practical computer science.docx
nishapatil20005
 
DOCX
Data Structure lab on a practical in computer science
nishapatil20005
 
PDF
C code on linked list #include stdio.h #include stdlib.h.pdf
deepua8
 
PDF
Code#include stdio.h #includemalloc.h struct node {  .pdf
brijmote
 
Doublylinklist
ritu1806
 
C++ Program to Implement Singly Linked List #includeiostream.pdf
angelsfashion1
 
linked listLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.pdf
minorproject456
 
Singly linked list program in data structure - Vtech
Vtech Academy of Computers
 
Ds 2 cycle
Chaitanya Kn
 
I need to fill-in TODOs in .cpp file and in .h file Could some.pdf
forladies
 
i nsert+in+ link list
EAJAJAhamed
 
Linked list imp of list
Elavarasi K
 
Singly linked list.pptx
Santhiya S
 
DSA(1).pptx
DaniyalAli81
 
C++Write a function void headEnqueue(Queue q, int key) which enqu.pdf
arjuncp10
 
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
FOREVERPRODUCTCHD
 
Double linked list header file below for FYI#include iostream.pdf
facevenky
 
In C++ I need help with this method that Im trying to write fillLi.pdf
fantoosh1
 
–PLS write program in c++Recursive Linked List OperationsWrite a.pdf
pasqualealvarez467
 
Data structure lab on practical computer science.docx
nishapatil20005
 
Data Structure lab on a practical in computer science
nishapatil20005
 
C code on linked list #include stdio.h #include stdlib.h.pdf
deepua8
 
Code#include stdio.h #includemalloc.h struct node {  .pdf
brijmote
 

More from ankitmobileshop235 (20)

PDF
- You have to overcome the ionic forces of the CsI, the hydrogen bon.pdf
ankitmobileshop235
 
PDF
Two sp3 orbitals are filled by lone electron pair.pdf
ankitmobileshop235
 
PDF
X-Intercept is the value of x where cross x axis. Another name is .pdf
ankitmobileshop235
 
PDF
whether or not the viruses is not used to classify viruses.Vir.pdf
ankitmobileshop235
 
PDF
Vi may be a powerful text editor enclosed with most UNIX systems, ev.pdf
ankitmobileshop235
 
PDF
U.S management is trained to provide the executives their own career.pdf
ankitmobileshop235
 
PDF
There are many operating systemsReal-Time Operating SystemReal-t.pdf
ankitmobileshop235
 
PDF
The three major forms of business organizations are1. Sole Propri.pdf
ankitmobileshop235
 
PDF
the OSI model is an idea. it is abstract it has no value without imp.pdf
ankitmobileshop235
 
PDF
The EVA metric effectively measures the amount of shareholder wealth.pdf
ankitmobileshop235
 
PDF
Reflection about the centre of the pentagon is not its symmetric and.pdf
ankitmobileshop235
 
PDF
Question not visible. Please state again.SolutionQuestion not .pdf
ankitmobileshop235
 
PDF
Per my quiz, it was also D) formation of the carbocatio or bromonium.pdf
ankitmobileshop235
 
PDF
Part ATay-Sachs disease is an autosomal recessive disorder, so, o.pdf
ankitmobileshop235
 
PDF
null is a subset of every setTrueSolutionnull is a sub.pdf
ankitmobileshop235
 
PDF
LiOH Sol.pdf
ankitmobileshop235
 
PDF
Information is a valuable asset that can make or break your business.pdf
ankitmobileshop235
 
PDF
Ho there is no relationship between the age of the individual and t.pdf
ankitmobileshop235
 
PDF
H2SO3 - H2O = SO2The oxide is sulfur dioxide SO2SolutionH2.pdf
ankitmobileshop235
 
PDF
First of all we shoud understand what is HIV AIDSHIV AIDS is .pdf
ankitmobileshop235
 
- You have to overcome the ionic forces of the CsI, the hydrogen bon.pdf
ankitmobileshop235
 
Two sp3 orbitals are filled by lone electron pair.pdf
ankitmobileshop235
 
X-Intercept is the value of x where cross x axis. Another name is .pdf
ankitmobileshop235
 
whether or not the viruses is not used to classify viruses.Vir.pdf
ankitmobileshop235
 
Vi may be a powerful text editor enclosed with most UNIX systems, ev.pdf
ankitmobileshop235
 
U.S management is trained to provide the executives their own career.pdf
ankitmobileshop235
 
There are many operating systemsReal-Time Operating SystemReal-t.pdf
ankitmobileshop235
 
The three major forms of business organizations are1. Sole Propri.pdf
ankitmobileshop235
 
the OSI model is an idea. it is abstract it has no value without imp.pdf
ankitmobileshop235
 
The EVA metric effectively measures the amount of shareholder wealth.pdf
ankitmobileshop235
 
Reflection about the centre of the pentagon is not its symmetric and.pdf
ankitmobileshop235
 
Question not visible. Please state again.SolutionQuestion not .pdf
ankitmobileshop235
 
Per my quiz, it was also D) formation of the carbocatio or bromonium.pdf
ankitmobileshop235
 
Part ATay-Sachs disease is an autosomal recessive disorder, so, o.pdf
ankitmobileshop235
 
null is a subset of every setTrueSolutionnull is a sub.pdf
ankitmobileshop235
 
LiOH Sol.pdf
ankitmobileshop235
 
Information is a valuable asset that can make or break your business.pdf
ankitmobileshop235
 
Ho there is no relationship between the age of the individual and t.pdf
ankitmobileshop235
 
H2SO3 - H2O = SO2The oxide is sulfur dioxide SO2SolutionH2.pdf
ankitmobileshop235
 
First of all we shoud understand what is HIV AIDSHIV AIDS is .pdf
ankitmobileshop235
 

Recently uploaded (20)

PPTX
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
PPTX
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PDF
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
PPTX
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
PPT
digestive system for Pharm d I year HAP
rekhapositivity
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PDF
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
PPTX
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
PPTX
Latest Features in Odoo 18 - Odoo slides
Celine George
 
PPTX
Presentation: Climate Citizenship Digital Education
Karl Donert
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
PPTX
How to Define Translation to Custom Module And Add a new language in Odoo 18
Celine George
 
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
Zoology (Animal Physiology) practical Manual
raviralanaresh2
 
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
digestive system for Pharm d I year HAP
rekhapositivity
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
How to Manage Access Rights & User Types in Odoo 18
Celine George
 
Latest Features in Odoo 18 - Odoo slides
Celine George
 
Presentation: Climate Citizenship Digital Education
Karl Donert
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
How to Define Translation to Custom Module And Add a new language in Odoo 18
Celine George
 

#includeiostream struct node {    char value;    struct no.pdf

  • 1. #include struct node { char value; struct node *next; }; class StringOfNode { struct node * head; public: StringOfNode() { head=NULL; } int size() { struct node *p=head; int count=1; while(p) { count++; p=p->next; } return count; } struct node * begin() { return head; } char &operator[](int index) { int i=0; struct node *p=head; while(index!=i) {
  • 2. p=p->next; i++; } return p->value; } void insertFront(char valuee) { struct node * temp=(struct node *)malloc(sizeof(struct node)); temp->value=valuee; temp->next=NULL; if(head==NULL) head=temp; else { temp->next=head; head=temp; } } void insert(char valuee, int pos) { struct node *p=head; struct node * temp=(struct node *)malloc(sizeof(struct node)); temp->value=valuee; temp->next=NULL; int i=0; if(p==NULL) { head=temp; } else { while(i!=pos-1) { p=p->next; i++; }
  • 3. temp->next=p->next; p->next=temp; } } void insertBack(char valuee) { struct node *p=head; struct node * temp=(struct node *)malloc(sizeof(struct node)); temp->value=valuee; temp->next=NULL; if(p==NULL) { head=temp; } else { while(p->next!=NULL) p=p->next; p->next=temp; } } void print() { struct node *p=head; while(p) { std::cout<value<<" "; p=p->next; } } StringOfNode operator+(const StringOfNode& b) { StringOfNode *S;
  • 4. struct node *p=head; while(p->next!=NULL) p=p->next; p->next=S->begin(); } }; int main() { StringOfNode *p1=new StringOfNode; p1->insertBack('b'); p1->insertBack('c'); p1->insertBack('e'); p1->insert('d',2); p1->insertFront('a'); p1->print(); system("pause"); return 0; } Solution #include struct node { char value; struct node *next; }; class StringOfNode { struct node * head; public: StringOfNode() { head=NULL; } int size()
  • 5. { struct node *p=head; int count=1; while(p) { count++; p=p->next; } return count; } struct node * begin() { return head; } char &operator[](int index) { int i=0; struct node *p=head; while(index!=i) { p=p->next; i++; } return p->value; } void insertFront(char valuee) { struct node * temp=(struct node *)malloc(sizeof(struct node)); temp->value=valuee; temp->next=NULL; if(head==NULL) head=temp; else { temp->next=head; head=temp;
  • 6. } } void insert(char valuee, int pos) { struct node *p=head; struct node * temp=(struct node *)malloc(sizeof(struct node)); temp->value=valuee; temp->next=NULL; int i=0; if(p==NULL) { head=temp; } else { while(i!=pos-1) { p=p->next; i++; } temp->next=p->next; p->next=temp; } } void insertBack(char valuee) { struct node *p=head; struct node * temp=(struct node *)malloc(sizeof(struct node)); temp->value=valuee; temp->next=NULL; if(p==NULL) { head=temp; } else
  • 7. { while(p->next!=NULL) p=p->next; p->next=temp; } } void print() { struct node *p=head; while(p) { std::cout<value<<" "; p=p->next; } } StringOfNode operator+(const StringOfNode& b) { StringOfNode *S; struct node *p=head; while(p->next!=NULL) p=p->next; p->next=S->begin(); } }; int main() { StringOfNode *p1=new StringOfNode; p1->insertBack('b'); p1->insertBack('c'); p1->insertBack('e'); p1->insert('d',2); p1->insertFront('a'); p1->print(); system("pause");