SOLVED - Translation to CMD? Console / Convert does NOT work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

SOLVED - Translation to CMD? Console / Convert does NOT work

SOLVED for myself ISSUE missing libraries SOLUTION manually type in additional libraries autofilled from Visual Studio Using Notepad++ and Dev CMD Prompt for this. I cannot get Convert to work for me at all. This is what I have: string userMiles; int milesToConvert; WriteLine ("How many miles would you like to convert?"); userMiles = ReadLine (); milesToConvert = Convert.ToInt32(userMiles); WriteLine ("You entered {0}.", milesToConvert); And no matter how I try to enter it, convert will not work.

16th Sep 2016, 10:52 PM
Desirae Gasaway
Desirae Gasaway - avatar
4 Answers
+ 2
This code works for me: string userMiles; int milesToConvert; Console.WriteLine ("How many miles would you like to convert?"); userMiles = Console.ReadLine (); milesToConvert = Convert.ToInt32(userMiles); Console.WriteLine ("You entered {0}.", milesToConvert);
16th Sep 2016, 11:35 PM
Zen
Zen - avatar
+ 1
You need to call the WriteLine() and the ReadLine() methods from its parent class Console.
17th Sep 2016, 5:28 AM
Pablo Hernandez
0
If I attempt to use anything being led by Console or Convert, Cmd tells me it does not exist in the current context
17th Sep 2016, 1:13 AM
Desirae Gasaway
Desirae Gasaway - avatar
- 1
Follow Zen's code, but Pay attention to the white/blank spaces between the method name and the parenthesis. You have to call the method By invoking the parent Class or module, in this case is Console: Console.WriteLine(); Console.ReadLine(); Console.Write();
17th Sep 2016, 10:15 AM
Marco Romanin
Marco Romanin - avatar