Dynamic Memory Allocation - Help please

Hello, ok, so here is my problem/issue I'm having with this code. This is a program that asks a user for days worked, pay rate and hours worked per day.
I'm supposed to create a pointer to a dynamically allocated array of the size equal to days worked.

I sorted coded everything before figuring out the pointer..I got stuck figuring out the math portion to get a gross total(1st issue)

Now, I am sort of working backwards and trying to figure how/where to build the pointer to the dynamically allocated array. (you will notice a big chunk of commented out code, this was my rough draft prior to adding in the pointer. I wanted to just get the basics in first then piece everything out.)

What I need help with.
1. building the pointer to a dynamically allocated array of the size equal to days worked
2. help with the math formula to calculate the gross pay

Here is what I have, if anyone could give me hand with I would appreciate it so MUCH!

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758`` ``````#include #include using namespace std; int main() { int *daysworked = nullptr, int hours; double payrate(0.0); int count; int grosspay; int totalhours; cout << "Enter the amount of days worked this pay period: "; cin >> count; daysworked = new int [hours]; cout << "What is your hourly pay rate? :"; cin >> payrate; for (count = 0; count < *daysworked; count++) { cout << "Enter hours worked for day " << count + 1 << ": "; cin >> hours; } /* while (count < size && hours[daysworked]) { count++; hours[count - 1] = daysworked; } cout << "What is your hourly pay rate? "; cin >> payrate; for (int index = 0; index < count; index++) { cout << "Enter hours worked for day "<< index+1<< ": "; cin >> hours[size]; } for (count = 0; count < daysworked; count++) { totalhours = daysworked + hours[size]; grosspay = totalhours * payrate; } cout << "Your gross pay will be: \$"; cout << grosspay << endl; */ return 0; }``````
Last edited on
hi,