an old arabic has it that a fabolously wealthy but unthinking king agreed to givea beggarone cent and double the amount for 64 days. using this information,write, run and test a c++ program that display how much the king must pay the beggar on each day. the output of your program should appear as follows
day amount owed
--- -----------
1 0.01
2 0.02
3 0.04
. .
. .
. .
64 .
b. modify the program you wrote for exercise 10a to determine on which day the king will have paid to the beggar a total of one million dollars.
1
Expert's answer
2012-10-09T11:27:05-0400
#include <string> #include <iostream> using namespace std;
int main() { & double t=0.01,c;
for (int i=1;i<65;i++){ t*=2; & cout<<i<<" quot;<<t<<"\n";& }
cout<<"\n\n"; system("PAUSE"); }
//b) #include <string> #include <iostream> using namespace std;
int main() { & double t=0.01; int c; for (int i=1;i<65;i++){ t*=2; & if (t>1000000){ & c=i; & i=66; } }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
You're welcome. We are glad to be helpful. If you really liked our service please press like-button beside answer field. Thank you!
thank you :)
Leave a comment