need stack pseudo code for the following ASAP dom plastic co


need stack pseudo code for the following ASAP

dom plastic container of Pez the colors are stored in random order Your tle brother Phil likes only the yellow lite ones, so he painstakingly takes out all th dies one by one, eats the yellow ones, and keeps the others in order, so that he can return them to the container in exactly the same order as before-minus the yell candies, of course. Write the algorithm to simulate this process. (You may us any of the stack operations defined in the Stack ADT, but may not assume any knowledge of how the stack is implemented.) 3. Using the Stack ADT: a. Download the text code files and set them up properly on y an nn

Solution

main()

{

int n,i,j,num[10],top[10={-1},ycnt=,i1=0,j1=0;

char c;

char candy[50][50],fcandy[50][50];

printf(\"enter number of plastic container\");

scanf(%d\",&n);

printf(\"number of candys present in %d plastic container\",n);

for(i=0;i<n;i++)

scanf(\"%d\",&num[i]);

printf(\"enter color for candy Y-->Yellow R-->Red B->BlackW-->White for each plastic container\");

for(i=0;i<n;i++)

{

for(j=0;j<num[j];j++)

{

scanf(\"%c\",&c);

top[i]++;

strcpy(candy[j][i],c);

}}

for(i=0;i<n;i++) {

for(j=0;j<num[j];j++) {

while(top[j]!=-1) {

if(strcmp(candy[[i][j],\"Y\")==0) {printf(\"yellow candy-you can eat\"); ycnt++;

else {strcpy(fcandy[i1][j1],candy[i][j]);

i1++;

}

ftop[j1]=i1

j1++;

}

}

printf(remaining candy in plastic container\")

for(i=0;i<n;i++){

for(j=0;j<ftop[j];j++){

printf (%c\",fcandy[j][i]);

}

}

}

 need stack pseudo code for the following ASAP dom plastic container of Pez the colors are stored in random order Your tle brother Phil likes only the yellow li
 need stack pseudo code for the following ASAP dom plastic container of Pez the colors are stored in random order Your tle brother Phil likes only the yellow li

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site