The code on itself works, tested in a seperate project using only that code, but when including it in this code the output is that when asking for the price and quantity I see:
Price:Quantity:
Then I can only input something after the quantity, meaning that the result (price) is always 0 as I just can't input to price.
Anyone knows what I'm doing wrong?
This is a test program, I know there are different ways to do this but just this on itself isn't working and I'm trying for hours..
After cin >> i; you're calling getline (cin,mystr2);.
The operator>> for integers leaves the endline character in the input buffer, unprocessed. getline() reads that endline character and immediately returns an empty string as "Price".
You need to consume that endline before calling getline(), e.g. by adding cin.ignore() or, to be robust, cin.ignore(numeric_limits<streamsize>::max(), '\n');