There is a producer who manufactures chocolate and a consumer who consumes that chocolate. Both producer and consumer maintains a stack. The stack on producer side keeps the track of variety of chocolate produced by the producer. The stack on consumer side keeps the track of particular variety of chocolate consumed by the consumer. Write a program which print '1' if the producer produces more chocolate of a particular variety than consumer consumes it and print '0' if any variety of chocolate produced is less than the consumption by the consumer for that particular variety.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question
2
Coding
DESCRIPTION
Problem Statement
There is a producer who manufactures chocolate and a consumer who
consumes that chocolate. Both producer and consumer maintains a
stack. The stack on producer side keeps the track of variety of
chocolate produced by the producer. The stack on consumer side
keeps the track of particular variety of chocolate consumed by the
consumer.
Write a program which print '1' if the producer produces more
chocolate of a particular variety than consumer consumes it and print
'0' if any variety of chocolate produced is less than the consumption
by the consumer for that particular variety.
Input Format:
• First-line contains producer's and consumer's stack length.
. Second-line producer stack values.
. Third line consumer stack values.
Output Format:
• Print 1 if any variety produced by producer is more than being
consumed by the consumer.
• Print 0 if any variety produced by producer is less than being
consumed by the consumer.
Evaluation Parameters
Sample Input 1
3
5
6
Transcribed Image Text:2 Coding DESCRIPTION Problem Statement There is a producer who manufactures chocolate and a consumer who consumes that chocolate. Both producer and consumer maintains a stack. The stack on producer side keeps the track of variety of chocolate produced by the producer. The stack on consumer side keeps the track of particular variety of chocolate consumed by the consumer. Write a program which print '1' if the producer produces more chocolate of a particular variety than consumer consumes it and print '0' if any variety of chocolate produced is less than the consumption by the consumer for that particular variety. Input Format: • First-line contains producer's and consumer's stack length. . Second-line producer stack values. . Third line consumer stack values. Output Format: • Print 1 if any variety produced by producer is more than being consumed by the consumer. • Print 0 if any variety produced by producer is less than being consumed by the consumer. Evaluation Parameters Sample Input 1 3 5 6
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning