Having a lot of trouble with C++ (problem)

I've been in this C++ programming class for a month a half now, and I still have no idea how to go about writing my own program. I've been reading the textbook and various internet articles for hours but they all seem to conflict or not fit with the problem that I need to solve. I was hoping somebody here could write me an algorithm I could work off of trying to figure out how to apply C++? I didn't want to have to take it to the forums but I'm so lost



In order to make up for the recent increases in tuition, you have opted to take a job as a cashier at a big box retailer. On your second day on the job, a blackout forces your entire cash register network down, leaving the checkout crews without ways to calculate and accept payment. After finding out that you are currently enrolled in a programming course, your boss offers to pay you time and half for the rest of the week if you can help him out.
In order to earn your extra pay, you must create a program that:
A) Accepts and adds prices on loop until the cashier enters zero.
B) Calculates and prints a subtotal.
C) Calculates and prints tax at a rate of 8.625%.
D) Accepts and prints an amount of payment.
E) Calculates change due the customer and tells the cashier how to make that change. Expect change in amounts up to the twenties of dollars. Do not print zero values.
F) It is possible that you will end up with one fewer penny than you should. Use the nearbyint() function in the math.h library, either when you begin calculating coins or when you get to the pennies depending on how you approach the problem. Nearbyint() is a function that rounds up to the next integer if the fraction portion is greater than .5 and down otherwise. Try it in a separate program to get a feel for it.
Sample Output:
Please enter a series of prices, to stop enter 0.
5.25
3.36
15.98
0
Your subtotal is 24.59
Your tax is 2.12
Your total is 26.71
Enter a payment.
30.00
You have paid 30 dollars.
Your change is 3.29
The cashier should give the customer:
3 dollars, 1 quarters, 4 pennies
closed account (3qX21hU5)
No one here will do your homework for you. We can help you out with errors in your coding or even help write certain parts of the code, but you have'nt even wrote anything yet... start writing some code and we can help you when you hit roadblocks but we wont do it for you.

Only hurting yourself by having someone else do it
i feel like that would be a challenge and ive been self studying for two weeks,

(listening to buckys tutorials on youtube, copying stuff down onto a notepad, testing out small simple programs messing with trying to display multidimensional loops)

and after a month that should be easy enough...get working and then ask people here why its not working...then you will get help, but buckys tutorials will recover everything youve done, shud be easy

ive heard you can learn nothing from a really long course if your just copying stuff of the board so i guess the trick is to practice
Start with
A) Accepts and adds prices on loop until the cashier enters zero.
When you've got a working program, add in the next step.

Divide and conquer.
This is what I got but it isn't working. It's not that I want somebody to do it for me I'm just lost and it's due tonight.

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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include<stdio.h>
#include<math.h>

void main ()
{
int price, subtotal, total, tax, tender;
float change;
int changeInDollars=0;
    int changeInCents=0;
            int Twenties, Tens, Fives
sum=0
	;
do 
{
printf("Please enter a series of prices, to stop enter "0""\n);
scanf("%d",&price);
getchar();
sum +=price;
} while (price != 0);
return 0;
}
tax=sum*.0825;
total=tax+sum
printf("Your subtotal is "%d", sum"\n);
printf("Your tax is "%d", tax"\n);
printf("Your total is "%d", total"\n);
} 
printf("Please enter tender"\n);
scanf("%d", &tender);
getchar();
printf("You have paid "%d", tender"\n);
if (tender<total)
	{
		printf("Please enter appropriate tender\n",x);
	}
else (tender>=total)
	{
		change=tender-total
			system("pause");
printf("Your changes is:$ %.2f\n", change);
 
    Twenties = int(change/20);
    change -= Twenties * 20;
    printf("Twenties: %i\n",Twenties);
 
    Tens = int(change/10);
    change -= Tens * 10;
    printf("Tens: %i\n",Tens);
 
    Fives = int(change/5);
    change -= Fives * 5;
    printf("Fives: %i\n",Fives);
 
    int dollars = int(change/1);
    change -= dollars;
    printf("Dollars: %i\n",dollars);
 
    change *= 100;
 
    int quarters = int(change/25);
    change -= quarters * 25; 
    printf("Quarters: %i\n",quarters);
     
    printf("Thank you come again!\n"); 
 
    getchar();
    return EXIT_SUCCESS;    
}
closed account (3qX21hU5)
I would like to apologize if I came off alittle rude, and I think what cire said is the best way to go about it. After the code you posted you obviously have the talent to code the program so just take it step by step. Start small and when you got it working add onto it and so on so on.
Topic archived. No new replies allowed.