Welcome back.
In this video, I want to quickly show you how to fix such a problem as we just had.
And again, I'm really struggling with ChatGPT in the sense of how much ChatGPT do I want to show you
and how much do I want to teach you in the course itself?
Because ChatGPT is an amazing additional tool that I would highly recommend that you use every now and
then when you are getting stuck and when you have a question.
But don't use it to solve the exercises, because if you do that, then you're not learning it, at
least not to the extent how I would recommend you learn it.
Okay, so I just said to ChatGPT this code when printing it displays decimal numbers such as 13.5 as
135.
And then I paste it in my code.
And how do I fix it?
I said.
So it says the issue you're describing with decimal numbers, such as 13.5, are displayed as one and
35 doesn't typically typically arise from the code you've shared.
So it says my code is fine.
However, it says it has to do with my culture.
So my German culture we're using the comma as a separator, a decimal separator.
And the US for example, they're using a dot.
So in order to fix it, we can use culture info that invariant culture with our double parse.
So how would that look like?
It looks like this where we're saying number one parse user input.
But then we add a comma and we add information such as the culture culture info invariant culture.
So let me copy that and let me go back to my solution here.
So here this is where I'm parsing my number one double parse.
So I'm just going to do exactly as it showed me.
I'm going to add a comma.
And then I'm using this class called Culture Info.
And the cool thing is this class it's is inside of the globalization class.
You can see that here.
It says system dot globalization dot culture info and it contains properties.
We're going to see what properties are.
But it contains this information about invariant culture.
And what it does is it says gets the culture info object that is culture independent and returns the
object that is culture independent, which means invariant, which means in this case it's just going
to accept the dot.
So let me run this again.
Now with this additional piece of code.
Now let's run this and look at it again 15.3 and 14 13.9.
And we get the result.
But you see it's still used 15 comma three instead of 15.3.
So now with what you saw with the approach that I showed you with the help of ChatGPT, I did fix this
problem.
How would I go about fixing the next problem where it now uses comma here instead of dot?
So I would recommend that you try this for yourself.
So see you in the next video where I'm going to show you my solution.