So here is my program:

#include <iostream>
#include <string>
#include <iomanip>
using namespace std;

int main()
{
	string lotName, bidder1_ID, bidder2_ID;
	double reservePrice, bidder1_bid, bidder2_bid;

	cout << "Enter lot name: ";
	getline (cin, lotName);
	cout << "Enter a reserve price:
	cin >> reservePrice;
	cout << "Bidder #1, enter your ID: ";
	getline (cin, lotName);
	cout << "Please enter your bid: $";
	cin >> bidder1_bid;
	cout << "Bidder #2, enter your ID: ";
	cin >> bidder2_ID;
	cout << "Please enter your bid: $";
	cin >> bidder1_bid;	
return 0;
}

When running this progr,am, everything goes smoothly until we submit reservePrice. When this occurs the program jumps to:

"Bidder #1, enter your ID: Please enter your bid: $"

Without letting me enter the ID. What is the problem?

Code tags:

[code]

// code here

[/code]

Whenever you mix getlines an the >> operator, you have to be very careful that >> doesn't leave a '\n' in the stream, so you need to flush the stdin stream. I'm guessing that's your culprit.

http://www.daniweb.com/forums/thread90228.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.