- Exercise 1 Steve Has Three Tools Iron Sward Diamond Pickaxe And Gold Shovel He Can Hold One Tool In His Hand One T 1 (59.43 KiB) Viewed 58 times
Exercise 1: Steve has three tools: iron sward, diamond pickaxe, and gold shovel. He can hold one tool in his hand, one t
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Exercise 1: Steve has three tools: iron sward, diamond pickaxe, and gold shovel. He can hold one tool in his hand, one t
Exercise 1: Steve has three tools: iron sward, diamond pickaxe, and gold shovel. He can hold one tool in his hand, one tool in his inventory hot bar, and one tool in the inventory. If Steve clicks F, his tools are swapped as follows: · The tool in his hand goes to the inventory The tool in the inventory goes to the hot bar The tool in the hot bar goes to his hand Write a C++ program to model switching between the tools. Write the function void swap(char hand, char hotBar, char inventory) which swaps the tools as indicated above. 2. Write the function void print(char hand, char hotBar, char inventory) which prints the contents of each as shown in the sample output. 3. In the main: a. In a loop, ask the user to click a button 6. If the user inputs F, swap the tools. If the user inputs N, do nothing. Print the contents of the player's hand, hot bar, and inventory. d. If the user inputs anything other than F or N, the program should exit. Sample output: The following tools are available to you! Mona Shatte die s: Sward : picke ti torch Hand Hot Sar Inventory Enter a comandi Hand Hot Bar Inventory Enter contand: F Hand Hot Bar Inventory P Enter a comandi N Hand Mot Sar Inventory Enter a comand Wees User\source repos Project Debug Project.exe (procesa 3796) excited with code e. Fress any key to close this window