Yes/No while loop help

Hi, I'm new to C++, and for a class project we had to write a code to exchange the user's input money value into change. What I want to do is create a yes or no loop so at the end of the code the user is asked if they would like to try again, if no then the program exits, yes then it starts again. How would I be doing so?

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
#include <iostream>
#include <math.h>
#include <limits>

using namespace std;

int main () {

    float money;
    int sum, quarter,dime,nickel,penny;

    cout << "Welcome to the CoinXchanger!" << endl;
    cout << "\nPress Enter to Continue ";
    cin.ignore(numeric_limits<streamsize>::max(),'\n');


        cout << "Please enter the amount of money (ie. 1.16): " <<endl;
        cin >> money;

        //Calculations
        sum = ceil(money*100);
        quarter = sum/25;
        sum = sum%25;
        dime = sum/10;
        sum = sum%10;
        nickel = sum/5;
        penny = sum%5;

        //Solution
        cout << "\nThe amount of money you have in change is..." << endl;
        cout << endl;
        cout << quarter; cout << " Quarters, "; cout << dime; cout << " dimes, ";
        cout << nickel; cout << " nickels, and "; cout << penny << " pennies." << endl;
        cout << endl;

        return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

    std::string Done;
    do
    {
       // Your code  

        do
        {
	      cout<<"Repeat proccess ? Y/N"<<endl;
	      cin>>Done;
	      system("cls");
        }while( Done != "y" && Done != "n" && Done != "Y" && Done != "X" );
		
     }while( Done == "Y" || Done == "y" );
}


Topic archived. No new replies allowed.