trying to type a loop

closed account (2U7DizwU)
I'm pretty new to programming, so any help or advice I can get is awesome.
I have an assignment to read in a program with a beginning balance and number weeks with a daily amount to be withdrawn every other friday. I've gotten through the portion where the user enters the desired time and starting amount, but I'm having trouble writing a loop that reads the first friday being 12 days after the start, and 14 every other after that. could anyone give me some suggestions? I'm trying to use a for loop currently. Thank you
Can you give us your code so far? and you could use a bool that says whether its the first friday or not.
closed account (2U7DizwU)

cout << "Enter initial account balance: ";
cin >> initial;
if (!(initial) || (initial < 0))
{
cout << "Error reading balance!" << endl;
return 3;
}

cout << "Enter length of simulation in weeks: ";
cin >> numberweeks;
if (numberweeks <= 0)
{
cout << "Error reading duration!" <<endl;
return 4;
}

this is where I'm having trouble

//calculate balance after n weeks

totaldays = (numberweeks * 7);
for(int day = 0; day < totaldays; day++)
{
sum = initial - daily;


if((day % 14) == 12)
{
sum = sum + paycheck;
}

dab =

}
cout << "Ending balance = " << endl;
cout << "Daily average balance = " << endl;
You know % is modulos, right?
I think that's whats messing up the program.
Topic archived. No new replies allowed.