You sum up pricetotal = pricetotal + price; before you do cin >> price;!
The value of price there is undefined and the variable itself contains garbage. So you're basically meddling in undefined behaviour.
Just move pricetotal = pricetotal + price; after you cin >> price; and things should work. Mind you, I didn't check for other errors, so fix this first.
About the string input.
cin >> product can only take one word of your input. It stops eating up characters as soon as it sees a space. So you must getline(cin, product); instead.
#include <iostream>
#include <string>
#include <iomanip>
// using namespace std ; // avoid; just type in std::cout etc.
int main()
{
std::cout << "Welcome to shopper's calculator!\n" ;
double price_total = 0 ; // use double as the default floating point type
std::string product;
// http://www.cplusplus.com/reference/string/string/getline/while( std::cout << "\nType in what you want to buy (type q to quit): " &&
std::getline( std::cin, product ) && // read in a complete line
product != "q" && product != "Q" )
{
// http://www.cplusplus.com/reference/string/string/empty/if( !product.empty() ) // product contains at least one character
{
std::cout << "Enter the price: $ ";
double price ;
if( std::cin >> price ) // if price was read successfully
{
if( price > 0.0 ) price_total += price ;
else std::cout << "price must be positive\n" ;
}
// http://www.cplusplus.com/reference/ios/ios/clear/else
{
std::cout << "invalid price: ignored.\n" ;
std::cin.clear() ; // input failed, clear the failed state of std::cin
}
// http://www.cplusplus.com/reference/istream/istream/ignore/
std::cin.ignore( 1000, '\n' ) ; // throw away the rest of this input line
}
}
// http://www.cplusplus.com/reference/ios/fixed/
// http://www.cplusplus.com/reference/iomanip/setprecision/
std::cout << "\nYour Total is $ " << std::fixed << std::setprecision(2) << price_total << "\n";
// there is an implicit return 0 ; at the end of main()
}