Update changed user input method on main menu
This commit is contained in:
@ -75,8 +75,9 @@ void MerkelMain::enterAsk()
|
||||
{
|
||||
std::cout << "Make an ask - enter the amount (product, price, amount. e.g. 'ETH/BTC, 200, 0.5)': " << std::endl;
|
||||
std::string input;
|
||||
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||
//std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||
std::getline(std::cin, input);
|
||||
|
||||
std::vector<std::string> tokens = CSVReader::tokenise(input, ',');
|
||||
if(tokens.size() != 3)
|
||||
{
|
||||
@ -114,10 +115,20 @@ void MerkelMain::gotoNextTimeframe()
|
||||
|
||||
int MerkelMain::getUserOption()
|
||||
{
|
||||
int userOption;
|
||||
int userOption = 0;
|
||||
|
||||
std::string line;
|
||||
std::cout << "Type in 1-6" << std::endl;
|
||||
std::cin >> userOption;
|
||||
std::getline(std::cin, line);
|
||||
//std::cin >> userOption;
|
||||
try
|
||||
{
|
||||
userOption = std::stoi(line);
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
std::cout << "Invalid input!" << std::endl;
|
||||
}
|
||||
std::cout << "You chose: " << userOption << std::endl;
|
||||
return userOption;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user