Question: Q 4 ( 2 5 pts ) . Write acomplete C + + program that performs the following: Your program should contain a find average

Q4(25 pts). Write acomplete C++ program that performs the following:
Your program should contain a find average function and a main function.
Assume that all stack behaviors are already present in a file called stack.h and hence you can #include "stack. h". The function void findavg(struct stack *s1, struct stack *s2) which takes two stacks as its arguments and pushes elements of stack s1, which are smaller than the average of all elements, into stack s2. Pay attention that the elements in stack s1 should be preserved.
In your main function:
Create two stacks s1,s2 with size 6.
Fill the stack s1 by accepting user inputs.
Call your function findavg and fill s2.
Q 4 ( 2 5 pts ) . Write acomplete C + + program

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 Programming Questions!