The program runs just fine, I have a while loop that keeps asking the person for the price and weight of an item. The loop works fine, but when i put 'N' in order to quit the loop, it quits the whole program instead of going onto the next function.
This is the whole function with the loop.
int getItemsInfo(float& totPrice, int& totWeight)
{
char choice;
float price;
int weight;
cout << "\n Do you want to order an item? Enter Y or N: ";
cin >> choice;
while(choice == 'Y' || choice == 'y')
{
cout << "Please enter the price: " << endl;
cin >> price;
cout << "Please enter the weight: " << endl;
cin >> weight;
totPrice += price;
totWeight += weight;
cout << "\n Do you want to order another item? Enter Y or N: ";
cin >> choice;
}
}
int getItemsInfo(float& totPrice, int& totWeight)
This function is designed to return an integer. There is no return statement in the function.
However, as Lorence30 says, without the context within which this function is called, it is not clear what the effect of this return value is on the calling function.