So, I was running my code and I would like to input a string. But It skips to the next input prompt. Here's the code : It starts with the "Enter Product Name" but instead, it skips right away to "Enter Product Type"
if (path == 3) {
std::ofstream ReferenceList;
while (again == "y" || again == "Y") {
ReferenceList.open("RefList.txt", std::ios::app);
std::string name, type, iprice;
std::cout << "Enter Product Name";
std::getline(std::cin, name);
std::cout << "Enter Product Type: ";
std::getline(std::cin, type);
std::cout << "Enter Y to Add Product Again: ";
std::cin >> again;
ReferenceList.close();
}
}
It skips right away to "Enter Product Type".
Here's the prompt display:
Enter Product NameEnter Product Type:
I would like to Enter the Product Name before Entering the Product Type.