Instructions: 1 #include 2 #include 1. In the code editor, you are provided with a treasureChestMagic() function which has the following description: 1. Return type - void 2. Name - treasureChestMagic 3. Parameters - an address of an integer 4. Description - updates the value of a certain integer randomly 2. You do not have to worry about how the treasureChestMagic() function works. All you have to do is ask the user for an integer and then call the treasureChestMagic() function, passing the address of that integer you just asked. 3. Finally, print the updated value of the integer inputted by the user. 3 4 void treasureChestMagic(int*); 5 6 int main(void) { 7 // TODO: Write your code here 8 return e; 10 } 11 12 void treasureChestMagic(int *n) { int temp = *n; int temp2 = temp; 13 14 Input 15 16 *n = *n + 5 - 5 * 5 / 5; 17 1. An integer 18 temp2 = (int) pow(2, 3); 19 Output if(temp % 3 == ®) { *n = temp * 10; } else if(temp % 10 == e) { *n = temp + 3; } else if(temp % 11 == e) { *n = temp 20 21 22 Enter n: 10 23 Treasure Chest Magic Result = 13 24 25 5; 26
Instructions: 1 #include 2 #include 1. In the code editor, you are provided with a treasureChestMagic() function which has the following description: 1. Return type - void 2. Name - treasureChestMagic 3. Parameters - an address of an integer 4. Description - updates the value of a certain integer randomly 2. You do not have to worry about how the treasureChestMagic() function works. All you have to do is ask the user for an integer and then call the treasureChestMagic() function, passing the address of that integer you just asked. 3. Finally, print the updated value of the integer inputted by the user. 3 4 void treasureChestMagic(int*); 5 6 int main(void) { 7 // TODO: Write your code here 8 return e; 10 } 11 12 void treasureChestMagic(int *n) { int temp = *n; int temp2 = temp; 13 14 Input 15 16 *n = *n + 5 - 5 * 5 / 5; 17 1. An integer 18 temp2 = (int) pow(2, 3); 19 Output if(temp % 3 == ®) { *n = temp * 10; } else if(temp % 10 == e) { *n = temp + 3; } else if(temp % 11 == e) { *n = temp 20 21 22 Enter n: 10 23 Treasure Chest Magic Result = 13 24 25 5; 26
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter12: Points, Classes, Virtual Functions And Abstract Classes
Section: Chapter Questions
Problem 1TF
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 3 images
Knowledge Booster
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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,