Jump to content
By fans, for fans. By fans, for fans. By fans, for fans.

Recommended Posts

Posted

Right I need to convert imperial to metric or whatever, and I am trying to multiply the figure typed in by the user to get the result and display it. However I can't seem to convert it.

 

I have tried creating a variable saying int (killo*2.2406) = impcon;, however that comes up with an error, I have also tried writing the multiplication within a convert to string function. Any advice would be greatly appreciated.

 

  string choice;
           int killo;
           double gram;
           int stone;
           double pound;
           int impcon;
           int metcon;


           Console.WriteLine("To convert to metric, please type 'metric' to convert to imperial, please write 'imperial'");
           choice = Console.ReadLine();
           Console.WriteLine("You have selected convert to {0}", choice);

           if (choice == "metric")
           {
               Console.WriteLine("Please enter killograms");
               killo = int.Parse(Console.ReadLine());
               Console.WriteLine("Please enter grams");
               gram = double.Parse(Console.ReadLine());
               Console.WriteLine("Your weight is {0} Killograms and {1} Grams", killo, gram);
               impcon = int.TryParse(Convert.ToString(killo.Equals * 2.206));
               Console.WriteLine("{0}", impcon);
               //Console.WriteLine("Your imperial weight is {0} Stone and (1)", 


 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...