I cannot figure out why this code doesn't stop and ask Do you want to run that again (y/n)"
If I take out all the else statments then it will ask but then output doesn't work like I want. Can someone point me at where I need to focus ?
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
// "\t" = tab right
// "\n" = postion cursor begining of newline
//define variables needed to perform conversion
int dollars = 0, qtrs = 4, dms = 10, nckls = 20; // integers used for math
char answer;
//char quarters;
//char dimes;
//char nickels;
//******************************************************************************
// Main Program Execution
//******************************************************************************
int main()
{
char rerun;//our re-run option
do//the do-while for a program rerun option
{
cout << "\t Please Enter the number of dollars to convert to coins " << endl;
cin >> dollars;
cout << "\t Would you like to convert to quarters, dimes, or nickels ?"<< endl;
cin >> answer;
{
if (answer == 'q') // determine if we want answer in quarters
{
cout << dollars << " dollars equals " << (dollars*qtrs) << " quarters" <<endl;
}
else
// determine if we want answer in dimes
if (answer == 'd')
{
cout << dollars << " dollars equals " << (dollars*dms) << " dimes " << endl;
}
else
// determine if we want answer in nickels
if (answer == 'n')
{
cout << dollars << " dollars equals " << (dollars*nckls) << " nickels " << endl;
}
}
// ask if we want to rerun
cout<<"Do you want to run that again (y/n)";
cin>>rerun;