“The 22 Psychological Triggers That Make Women Chase You… Starting Tonight”

Forget the cash, the cars, and the chiseled jawlines. Female desire operates on a completely different frequency. Primal. Subconscious. Triggers that bypass her logic and hit her on a gut level. Most guys are totally blind to them.

I know because I was one of them. The overthinking. The paralysis. The silent drive home kicking yourself for freezing up. Watching average guys walk away with the girl while you stood there stuck in your own head.

Then I decoded the psychology behind what actually makes women tick. 22 hard rules.  Subtle behavioral shifts that rewired my entire reality. The anxiety evaporated. Women started leaning in. Investing. Chasing.

Read more...

c# proyect

azrael

Don Juan
Joined
Aug 30, 2008
Messages
72
Reaction score
1
i think there are some programmers here so i am looking for a little bit of help.
i need to make a temp. converter in c# (using visual studio express 2010)

the form is : enter a value in a text box,
choose from what temp. to the other to convert using a "combo box"
for example from

Fahrenheit to Celsius. and when you press a "execute button" the conversion would display in another textbox

but i am having troubles doing it, my approach was


if (comboBox1.Text == "FAHRENHEIT A CELSIUS")
{

a =Convert.ToInt32( textbox1.Text);
c= (a - 32) / 1.8;
textbox2.Text = c.ToString();
}

but that is not working . i made a calculator using something like that.

if you guys can point me in the right direction it would be much appreciated
 

mikeyb

Senior Don Juan
Joined
May 10, 2007
Messages
472
Reaction score
16
Age
38
Location
UK
Trying to use int32 type for floating point operations (i.e. decimals) will produce problems because int32 only stores integers. Use the "double" type instead.
 

synergy1

Master Don Juan
Joined
Sep 22, 2006
Messages
1,984
Reaction score
192
mikeyb said:
Trying to use int32 type for floating point operations (i.e. decimals) will produce problems because int32 only stores integers. Use the "double" type instead.
In C, you can use both i believe, int32 would likely only truncate the answer by removing trailing decimals and rounding, not cause an compile error but will clearly be a runtime error.

Also not sure on the rules of C#, if you have an int in an equation and divide by a double, will the result convert to an int or a double? Had a lot of runtime errors based on passing integers through functions and having them convert or drop decimal places.
 

Teflon_Mcgee

Master Don Juan
Joined
Apr 3, 2006
Messages
918
Reaction score
27
Besides the whole int32 vs. double (which shouldn't be that big of a deal in c#)
there is also this

comboBox1.Text == "FAHRENHEIT A CELSIUS"


A more proper way would be to use any of the following:


1. if(comboBox1.Text.CompareTo("FAHRENHEIT A CELSIUS") == 1);
2. if(String.Compare(comboBox1.text, "FAHRENEHEIT A CELSISU") == 1);
3. if(comboBox1.Text.Equals("FAHRNEHEIGHT A CELSIUS") == 1);
 

azrael

Don Juan
Joined
Aug 30, 2008
Messages
72
Reaction score
1
thank you so much!!!!!

i just needed to change the way i was declaring the value for the program to run


up here i did not pust it but it was a:

int a=0,c=0;
i just needed to change the int for double


if (comboBox1.Text == "FAHRENHEIT A CELSIUS")
{

a =Convert.ToInt32( textbox1.Text);
c= (a - 32) / 1.8;
textbox2.Text = c.ToString();



and +1 to you guys

}
 

Huffman

Master Don Juan
Joined
Oct 29, 2007
Messages
1,499
Reaction score
166
Teflon_Mcgee said:
A more proper way would be to use any of the following:


1. if(comboBox1.Text.CompareTo("FAHRENHEIT A CELSIUS") == 1);
2. if(String.Compare(comboBox1.text, "FAHRENEHEIT A CELSISU") == 1);
3. if(comboBox1.Text.Equals("FAHRNEHEIGHT A CELSIUS") == 1);
As long as he's staying with C#, the == will do just fine. The whole reference vs value comparison is an ugly thing and I agree that for good style you should always use Equals, but just saying that in C# the == operator is overloaded for equals.

In Java it wouldn't work however I think... makes for alot of ugly bugs.
 

Teflon_Mcgee

Master Don Juan
Joined
Apr 3, 2006
Messages
918
Reaction score
27
Huffman said:
As long as he's staying with C#, the == will do just fine. The whole reference vs value comparison is an ugly thing and I agree that for good style you should always use Equals, but just saying that in C# the == operator is overloaded for equals.

In Java it wouldn't work however I think... makes for alot of ugly bugs.

Yes, that's why C# is so awesome. Any Windows utility I make I ALWAYS do in C# (where I used to use Java as it's easier to do GUI's than C++.)

But I'm a hardware guy so I spend my time in assembly and C, unfortunately.
 
Top