Question: Q2 (1 point) Write a program in which you declare an array of chars and store the piece of text All the world's a stage.

 Q2 (1 point) Write a program in which you declare an

Q2 (1 point) Write a program in which you declare an array of chars and store the piece of text All the world's a stage. Exclude the quotation marks. Do not use the string type. Do not over-allocate the amount of memory that you need. Now display that piece of text. Then declare an array of 100 doubles. Display the addresses of the 16th, 45th and 90th doubles in that array. Q3 (3 points) Write a C++ program for the following. Do not try to generalize this problem into an equation. The goal is to practice iterations/loops. There is an old story that an emperor wanted to thank the inventor of the game of chess and asked the inventor to name his reward. The inventor asked for one grain of rice for the first square, 2 for the second, 4 for the third, and so on, doubling for each of the 64 squares. That may sound modest, but there wasn't that much rice in the empire! Write a program to calculate the number of squares that are required to give the inventor a stated number of grains of rice that is provided as the input. For example, the program should calculate the number of squares that are required to earn at least 1000 grains of rice, at least 1,000,000 grains, at least 1,000,000,000 grains, etc. You'll need a loop, of course, and probably an int to keep track of which square you are at, a double to keep the number of grains on the current square, and a double to keep track of grains of all previous squares. We suggest that you print the value of all your variables for each iteration of the loop so that you can see what's going on. Demonstrate that the program works using sample inputs from the user

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!