Question: C++ Program - Circular Linked List - Template - Node User enters a sentence. The program takes every character from that sentence and adds it
C++ Program - Circular Linked List - Template - Node
User enters a sentence. The program takes every character from that sentence and adds it to a linked list.
Then the program takes every other letter from the sentence and puts it in a removal list.
The program then does the loop again and removes every other letter. It keeps doing this loop until there are no letters in the sentence left.
All the letters that were removes are added at the end of the removal list.
Then print the removal list.
For example,
User enters the sentence, "Computer Science".
The program puts that into a linked list, then removes every other letter starting from C and puts those letters into a removal list.
Sentence: Computer Science
Remove every other letter: Co[m]p[u]t[e]r[ ]S[c]i[e]n[c]e
New Sentence: CoptrSine
Removal List that contains all the characters removed: mue cec
=====NEXT LOOP=====
New Sentence: CoptrSine
Remove every other letter: Co[p]t[r]S[i]n[e]
Removal List that contains all the characters removed: mue cec prie
====NEXT LOOP====
New Sentence: CotSn
Remove every other letter: Co[t]S[n]
Removal List that contains all the characters removed: mue cec prie tn
===NEXT LOOP===
New Sentence: CoS
Remove every other letter: Co[S]
Removal List that contains all the characters removed: mue cec prie tn S
=========
No matter what the user enters, the loop keeps going as long as there are any characters in the sentence. Keep doing this and remove every other letter and put it in the removal list. Once there are no more characters left in the sentence, print the removal list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
