Write a C++ program that asks the user to enter an integer n followed by n numbers. The program will use 2 stacks to enter the numbers entered by the user. In every iteration the program will balance the total of the numbers stored in every stack. For example, if the user already entered 10 (the program stores this value in stack 1) and 23.5 (the program stores this value in stack 2) and then enters the value 4.7 then the program will store this value in stack 1 since 10<23.5. If the user enters 12.3, then the program will store it in stack 1 since the total in stack 1 is 14.7 (10+4.7) and 14.7<23.5. If the user enter 7, then the program will store this value in stack 2 since the total in stack 1 is 27 (14.7+12.3) and 27>23.5.
At the end, the program will display on the screen the content of every stack.
samytaqq
0
Newbie Poster
Recommended Answers
Jump to PostWhat have you coded so far? is there a specific problem you need help with?
Jump to PostAre you sure you are not going against MEMBER RULES ?
All 5 Replies
zeroliken
79
Nearly a Posting Virtuoso
TrustyTony
888
pyMod
Team Colleague
Featured Poster
m4ster_r0shi
142
Posting Whiz in Training
TrustyTony
888
pyMod
Team Colleague
Featured Poster
m4ster_r0shi
142
Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.