#### Cant seem to be able to get a total to see how many dishes can be made within a time frame thats given C++ [closed]

Hey all i got a program that lets the user enter how long to make a dish and then how long to make the next dish after that and lets the user enter how long they have to prepare dishes heres a better explanation

Bianca is preparing special dishes for her daughterâ€™s birthday.

It takes her a minutes to prepare the first dish, and each following dish takes b minutes longer than the previous dish. She has t minutes to prepare the dishes.

For example, if the first dish takes a = 10 minutes and b = 5, then the second dish will take 15 minutes, the third dish will take 20 minutes, and so on.

If she has 80 minutes to prepare the dishes, then she can prepare four dishes because 10 + 15 + 20 + 25 = 70.

Write a program that prompts the user to enter the values of a, b, and t, and outputs the number of dishes Bianca can prepare.

Now i have gotten everything to work but i cannot seem to understand how to get a running total but still gice me how many dishes can be made heres my code and what i get

``````#include <iostream>

using namespace std;
int a, b, t, c, total;
int dishesCal;

int main() {
cout << "Please enter how long it takes to prepare first dish: " << endl;
cin >> a;
cout << "How long after first dish: " << endl;
cin >> b;
cout << "How long do you have to prepare all the dishes: " << endl;
cin >> t;
while (a <= t)
{
a = a + b;
total = total + a;
c ++;
}
cout << "You can make " << c
<< " dishes";

return 0;
}
``````
``````Please enter how long it takes to prepare first dish:
10
How long after first dish:
5
How long do you have to prepare all the dishes:
80
You can make 15 dishes
``````

Source: Windows Questions C++