How to ask the user to repeat this program?

Im very new at this. I want to ask the user if he wants to repeat the program again by inputing Y or N or something like that. How can I do this. Sorry if it is pretty easy and I just dont know how yet.

Heres my code:

#include <iostream>
using namespace std;

int main()
{
//Declare Variables
double mouse, weight_of_friend, friend_sweetener, mouse_sweetener, sodas, wei$

//Input
cout << "\n" << "Enter the weight of your friend (lbs): ";
cin >> weight_of_friend;
cout << "Enter the weight of the mouse(g): ";
cin >> mouse;
cout << "Enter the lethal dose of sweetener for a mouse(mg): ";
cin >> mouse_sweetener;

//Process Data
mouse = mouse / 1000;
weightkg = weight_of_friend / 2.2046228;
friend_sweetener = (weightkg * mouse_sweetener) / mouse;
sodas = friend_sweetener / 180;

//Output
cout << "\n" << "If your friend weighs " << weight_of_friend << " lbs, then $
cout << friend_sweetener << " grams.\n";
cout << "\n" << "This means your friend could safely drink " << sodas << " ca$

return 0;
}
google c++ while loop
Topic archived. No new replies allowed.