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.
1
Expert's answer
2016-05-11T08:48:02-0400
#include <list>; using namespace std; int main() { // first part list <char> alphabet(26); // second part char ch = 'a'; for (list <char>::iterator it = alphabet.begin(); it != alphabet.end(); ++it) *it = ch++; // third part for (list <char>::const_iterator it = alphabet.begin(); it != alphabet.end(); ++it) cout << *it << endl; return 0; }
Comments
Leave a comment