0
How to Convert A string to a variable?
Trying to make a user-input calculator, tried myself but came up with too many errors.
2 Answers
0
Do you mean this?
string _UserInput = Console.ReadLine();
Or this?
int _UserInputs = Convert.ToInt32(Console.ReadLine());
0
For a user input string use:
string variableName = Console.ReadLine();
For a user input integer you need to convert the user input (which is always considered a string) into an integer value using:
int variableName = Convert.ToInt32 (Console.ReadLine());