63 151
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #59829 in C++ for adrain

Question #59829
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's answer
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions