0

So I am at the start of my programming career and I wrote a code for a simple vending machine on C++.

The problem is, when people pay, they need to input their change into the console like: " 0.50€" for 50 cents. The problem is I live in Europe, and most of the people put in commas as floating numbers like "0,50€". The program collapses when this happens. How do I solve this elegantly? With either the program discovering it and mentions their failure so they can type it in correctly or, better, accepts it as a normal floating-point number.

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
  • 2
    It would help if you post the relevant code fragment and explain what exactly goes wrong, for example, does your program crash or do you get an error message? – rveerd May 22 '20 at 10:08

1 Answers1

1

It is a matter of locale settings. This question may help you in setting the locale you need in your program.

sergeous
  • 33
  • 4