This is pretty damn embarassing, I've been programming for a really long time and have been defeated by a trivial problem.
#include "stdafx.h"
#include <string>
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int choice = 0;
string itemDesc;
double itemPrice;
cout << "1. Process a sale" << endl;
cout << "2. View sales totals" << endl;
cout << "3. Change the GST percentage" << endl;
cout << "4. Quit" << endl;
cin >> choice;
cout << "Enter Item Description " << endl;
getline(cin, itemDesc);
cout << "Enter Item Price" << endl;
cin >> itemPrice;
return 0;
}
So as you may have guessed from the code, I'm creating a little store/cashier program. First a menu is displayed, the user chooses what he wants to do out of the four options. The option is read into the variable "choice".
So far so good, here comes the problem. After the user chooses an option, he should then prompted to "Enter Item Description", which should be read into the variable itemDesc.
That doesn't happen.
Instead after choosing from the menu you are prompted like this
Enter Item Description
Enter Item Price
With only the price being available for you to input. I've checked the variable itemDesc and it is completely blank. I've spent the last two hours on this and finally decided to get some help.
Thanks in advanced,
Angus