Enter the number of quarters for w1 31 Enter the number of dimes for wl : 4 Enter the number of nickels for wl : 2 Enter the number of quarters for wl: 5 Enter the number of quarters for w2: 4 Enter the number of dimes for w2 : 5 Enter the number of nickels for w2: 3 Enter the number of quarters for w2: 2 W2 : 3 quarters. 4 dimess 2 nickels 5 cents amount = $1.3 4 quarters 5 dimess 3 nickels 2 cents amount = $1.67 w2 amount is greater than wl Create new Wallet w3 by adding wl and w2 W3: 7 quarters 9 dimess 5 nickels 7 cents amount $2.97 Enter the number of quarters for w1 Enter the number of dimes for w1 Enter the number of nickels for wl Enter the number of quarters for w1 Enter the number of quarters for w210 Enter the number of dimes for w2 : 3 Enter the number of nickels for w2 : 3 Enter the number of quarters for w2: 7 W1 : W2 : 10 quarters 2 dimess 5 nickels 4 cents ----> amount = $2.99 10 quarters 3 dimess 3 nickels 7 cents 10 : 2 : 5 4 amount = $3.02 w2 amount is greater than w1 Create new Wallet w3 by adding wl and w2 W3 : 20 quarters 5 dimess 8 nickels 11 cents. ----> amount = $6.01
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
Use C++
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 3 images