Looping question?

I really need help on looping, I don't know if for loop will be used.
My program looks like this:

Choose a product:
Candies
Junk Foods
Soft Drinks

Enter your choice: Candies

Candies:
Snowbear = Php 1.00

Stock: 100

Enter the Candy of your choice: Snowbear
How many: 3
Enter the amount of your money: 10
Change: Php 7.00

Remaining Stock: 97

Ok so after running all of that, I want to add a question that will allow the user to buy again.

For example (I want it to look like this)

Want to buy another candy?
If yes type "YES"
If no type "NO"

Please give me an idea so I can add a loop that will ask the question above.
I need help asap.

PS. This is my final project, I know our prof. is lurking around here somewhere :P, So please just give me an idea

A loop has essentially two parts: condition and body.

The condition determinies how many times the body will be executes.
The body is all the instructions that you want to repeat.

For example:
1
2
3
4
5
6
#include <iostream>

int main()
{
  std::cout << "Hello World!\n";
}

We want to run the line 5 for 7 times:
1
2
3
4
5
6
7
8
9
#include <iostream>

int main()
{
  for ( int count=0; count < 7; ++count )
  {
    std::cout << "Hello World!\n";
  }
}

Maybe they are still doing something while buying candy?
Topic archived. No new replies allowed.