Question: Part 2 : In class, you were given the source code for building a queue data structure based on a linked list. You are given

Part 2:
In class, you were given the source code for building a queue data structure based on a linked list. You are given this source code (assign4_part2.cpp) but it misses the implementation of the "vowelCheck" fuction. You are asked to provide the implementation of this function as described below.
The vowelCheck fucntion receives two queues and copies the elements from the first queue into the second queue when the element value is not vowel.
Hint: Vowel Letters are {A,O,I,E,U,a,o,i,e,u}.
\table[[\table[[Example of Input Queues to the function],
Import Notes:
You are NOT allowed to change the parameters given for the "oddCheck" and "vowelCheck" functions. #include
using namespace std;
struct Node {
char data;
struct Node *next;
};
char peek(Node *front, Node *rear){ return front->data; }
void enqueue(Node **front, Node **rear, int data){
Node *newNode = new Node;
newNode->data = data;
newNode->next = NULL;
if (*front == NULL){
*front = newNode;
*rear = newNode;
} else {
(*rear)->next = newNode;
*rear = newNode;
}
}
char dequeue(Node **front, Node **rear){
Node *temp =*front;
char x =(*front)->data; // or int x = temp -> data;
*front =(*front)->next;
if (*front == NULL)
*rear = NULL;
delete temp;
return x;
}
void printQueue(Node *front, Node *rear){
if(front != NULL){
Node *curr = front;
while (curr->next != NULL){
cout curr->data "";
curr = curr->next;
}
cout curr->data "";
cout endl;
}
}
void VowelCheck(Node *front1, Node *rear1, Node **front2, Node **rear2){
}
int main(){
Node *front1= NULL;
Node *rear1= NULL;
Node *front2= NULL;
Node *rear2= NULL;
enqueue(&front1, &rear1,'M');
enqueue(&front1, &rear1,'o');
enqueue(&front1, &rear1,'h');
enqueue(&front1, &rear1,'a');
enqueue(&front1, &rear1,'m');
enqueue(&front1, &rear1,'m');
enqueue(&front1, &rear1,'a');
enqueue(&front1, &rear1,'d');
printQueue(front1, rear1);
VowelCheck(front1, rear1, &front2, &rear2);
printQueue(front2, rear2);
return 0;
}
 Part 2: In class, you were given the source code for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!