Pointers and Linked Lists: Linked Lists #include current=top; while(current!=NULL) { cout<data<<" " current=current->next; } cout<data=.1; for (i=2;i<=10;i++) { current ->next%3Dnew node; current=current->next; current ->data=i/10.0; } current ->next=NULL; This makes sure the list is NULL terminated. ; output: 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 This NULL terminates the list. Now you can write a program that creates a linked list with 26 nodes, fills them with the letters of the alphabet, and then prints them. Use three separate loops: one for creating one for filling, and one for printing, Make sure the last node points to NULL.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please code using C++ and only use the headers <iostream>. The use of any other headers will not be accepted. Thank you!

Pointers and Linked Lists: Linked Lists
#include <iostream>
current=top;
while(current!=NULL)
{
cout<<current->data<<" ";
current=current->next;
using namespace std;
struct node
{
double data;
node * next;
};
int main()
{
node *top, * current;
int i;
top=new node;
current=top;
top->data=.1;
for (i=2;i<=10;i++)
{
current ->next=new node;
current=current->next;
current ->data=i/10.0;
}
current ->next=NULL;
This makes sure the list
is NULL terminated.
}
cout<<endl;
return 0;
}
output:
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
This NULL
terminates the list.
Now you can write a program that creates a linked list with 26 nodes, fills them with the
letters of the alphabet, and then prints them. Use three separate loops: one for creating,
one for filling, and one for printing. Make sure the last node points to NULL.
Transcribed Image Text:Pointers and Linked Lists: Linked Lists #include <iostream> current=top; while(current!=NULL) { cout<<current->data<<" "; current=current->next; using namespace std; struct node { double data; node * next; }; int main() { node *top, * current; int i; top=new node; current=top; top->data=.1; for (i=2;i<=10;i++) { current ->next=new node; current=current->next; current ->data=i/10.0; } current ->next=NULL; This makes sure the list is NULL terminated. } cout<<endl; return 0; } output: 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 This NULL terminates the list. Now you can write a program that creates a linked list with 26 nodes, fills them with the letters of the alphabet, and then prints them. Use three separate loops: one for creating, one for filling, and one for printing. Make sure the last node points to NULL.
16: linkedList.cpp) Write a program in three parts. The
first part should create a linked list of 26 nodes. The second
part should fill the list with the letters of the alphabet. The
third part should print the contents of the linked list.
Transcribed Image Text:16: linkedList.cpp) Write a program in three parts. The first part should create a linked list of 26 nodes. The second part should fill the list with the letters of the alphabet. The third part should print the contents of the linked list.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to Coding
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education