Programm not working properly

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
ilifka1
New to forums
New to forums
Posts: 1
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Wed Jan 07, 2015 2:55 am

Programm not working properly

Post by ilifka1 »

Hallo!
I have problem with my VPS. My PC running the same OS as on VPS!But my :arrow: VPS dond't read programm code properly (as my coder says).I'll give you a proof (C#):
{
string price = "0,09";
double coef = 1.15;
int price1 = Convert.ToInt32(Convert.ToDouble(price) * 100);
price1 = Convert.ToInt32(Convert.ToDouble(price1) / coef);
MessageBox.Show(price1.ToString());
}

Result on your VPS is 783, but it should be 8 .And all my frinds have the same result: 8.

Please explaing me how to solve it.
User avatar
Edge100x
Founder
Founder
Posts: 13190
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Programm not working properly

Post by Edge100x »

You mistakenly used a comma in your first number and a period in your second. A comma is interpreted differently depending on your localization settings.

900 divided by 1.15 is 782, when cut off to an int, so the answer you are getting on the VDS is correct when commas are ignored (the US standard).

Switch the comma to a period, and you'll get the answer you prefer.

This is a good site for asking programming questions: http://stackoverflow.com/
Post Reply