CAN YOU HELP ME GUYS? COZ ITS TO BE SUBMITTED TODAY 10 AM PH time

MIDTERM

1. Suppose you are given 1 cent on day 1 and on day 2 you are
given twice as much. If each day you are given twice as much
as on the previous day, then on day 10, how many pennies will
you receive? Can you program that? (HINT: use loops)


Last edited on
I got you, give me a few
Here you go:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#include <iostream>
using namespace std;
int main()
{	
	int numberofDays;
	cout << "Enter how many days you'd like to calculate: ";
	cin >> numberofDays;
	double amount=0;
	for(int i=0;i<numberofDays;i++)
	{
		if(i==0)
		{
			amount += 1;
		}
		else if(i>=1)
		{
			amount = amount*2;
		}
		
		
	}
	if(amount<=99)
	{
		cout << "You have " << amount << " cents." << endl;
	}	
	
	if(amount>=100 && amount <=99999)
	{
		double amount2=amount/100;
		cout << "You have " << amount2 << " dollars or " << amount << " cents." << endl;
	}
	if(amount>=100000 && amount<=99999999)
	{
		double amount3=amount/100000;
		cout << "You have " << amount3 << " thousand dollars." << endl;
	}
	if(amount>=100000000)
	{
		double amount4=amount/100000000;
		cout << "You have " << amount4 << " million dollars." << endl;
	}
	
}
You probably shouldn't be giving a solution to someone who is obviously just using it to cheat on a midterm.
Why not? If he graduates, it just means less job market competition!
Tru3, Plus I honestly just did it to get some more practice for my class. I'm fine with being in the advantage.
closed account (18hRX9L8)
I think you're in the wrong place. This is a forum, a social mixer where everyone is on the same level.[1] This is not the place to downsize your competition or get an advantage over people. You come here for at least one of two things: to get and/or receive help. If you're not doing at least one of those things, you shouldn't be here.

And no, giving out the answer to a copy-pasted homework assignment is not helping. You are just making it worse for that person in the long run. I think you already know why.

What keeps this site going is an understood mutual relationship: People post on this site trusting that they will get the most useful help for solving their problem. People answer questions (generating useful content) knowing that if they continue to do so, the site will keep running and will be up when they have questions of their own (and also to learn stuff in the process of figuring out answers to questions).

When you post something that hurts people now or in the long run (and has no useful content for future readers), you are degrading the very foundation of this relationship. People who actually want to understand will stop posting good questions because they'll just be getting a block of code back. Eventually, people will stop posting answers and the site will shut down.

Please think about what you are doing. Thank you.

[1]: To clarify, everyone's getting or giving help, there's no way you can get some advantage over people. It doesn't make any sense.

EDIT: Add clarification.
Last edited on
Definitely Possible, You're taking this too deep. Go smoke a little
Topic archived. No new replies allowed.