Page 1 of 1

Coal ores can be squished together to Crafting form coal blocks. Coal blocks can be broken down back to coal ores. A coa

Posted: Sat Nov 27, 2021 2:33 pm
by answerhappygod
Coal Ores Can Be Squished Together To Crafting Form Coal Blocks Coal Blocks Can Be Broken Down Back To Coal Ores A Coa 1
Coal Ores Can Be Squished Together To Crafting Form Coal Blocks Coal Blocks Can Be Broken Down Back To Coal Ores A Coa 1 (72.48 KiB) Viewed 93 times
Coal ores can be squished together to Crafting form coal blocks. Coal blocks can be broken down back to coal ores. A coal block is equivalent to 9 coal ores. Both processes are done in the crafting table. Write a C++ program to model crafting with coal. 1. Declare the function void craftCoalint& coalOres, int& coalBlocks) which: 2. Takes the number of coal ores as well as coal blocks b. If the number of coal ores is less than 9, then function should break the coal blocks down to ores and add it to the number of coal ores. c. Else, the function should try to convert as many of the coal ores to blocks as possible. A block can only be crafted with exactly 9 ores. 2. In the main, ask the user how many coal blocks and ores they have in their inventory, then call craftCoal. Print the updated number of coal ores and blocks. Sample output: K Microsoft Visual Studio Debug Console How many do you have of the following? Coal ores: 70 Coal blocks: 6 Crafting... You now have 7 Coal Ores and 13 Coal Blocks K Microsoft Visual Studio Debug Console How many do you have of the following? Coal ores: 8 Coal blocks: 16 Crafting... You now have 152 coal Ores and a coal Blocks