In this code, when the program is repeated, it skips over the salesperson's name entry. Can someone point out what I'm missing
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
string salespersonname;
int main()
{ char choice;
do{
double monthly_sales = 0.00, subtotal = 0.00;
cout << "Please enter the salespersons name: ? ";
getline (cin,salespersonname);
cout << "Please enter the sales from each month in the quarter."<<endl;
#include <iostream>
#include <string>
#include <iomanip>
#include <limits> // To use std::numeric_limits.
usingnamespace std;
string salespersonname;
int main()
{
char choice;
do {
double monthly_sales = 0.00, subtotal = 0.00;
cout << "Please enter the salespersons name: ? ";
getline(cin, salespersonname);
cout << "Please enter the sales from each month in the quarter." << endl;
for (int count = 1; count <= 3; count++)
{
do {
cout << "Month " << count << " Sales: $ ";
cin >> monthly_sales;
if (monthly_sales < 0)
{
cout << "Not a vaild entry, please try again" << endl;
}
subtotal = monthly_sales + subtotal;
} while (monthly_sales < 0);
}
cout << fixed << showpoint << setprecision(2);
cout << "The quarter average sales for " << salespersonname << " is $"
<< subtotal / 3 << endl;
cout << endl << "Would you like to perform other calculation?(Y/N)" << endl;
cin >> choice;
// The cin.ignore function tells the cin object to skip one or more
// characters in the keyboard buffer.
// It skips the max number of characters or until a newline (\n)
// is encountered.
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
} while (choice == 'Y' || choice == 'y');
}