0
Good evening, folks. A basic question:
In the code below
class Conversora
{
double Oneknot = 1.852; // km/h
public void Conversor(){
Console.WriteLine("Informe a velocidade em nós: " );
int speed = Console.Read();
Console.WriteLine("A velocidade em km/h é de: " + Oneknot * speed);
Console.ReadKey();
}
The reading of the speed variable does not come out according to what was typed. Example: if I type 240 nodes, the variable receives only 50. Soon the conversion of nodes to km/h leaves with wrong result.
Does anyone give a help to Noob here ? rs
I think we missed the
!
– Jéf Bueno
@LINQ I was on smartphone haha, I have not tested. I have edited, thank you! =)
– Francisco
It worked @Francisco. Thanks for the touch with int.Tryparse ;)
– wes85melis