My problem is, the code looks fine, compiles fine, but has a run time error.
I'm not sure if it is the code or if I am missing and important package or what.
Here the code:
using System;
class InputIntro
{
public static void Main()
{
string input = "";
int intTest = 0;
float floatTest = 0;
Console.WriteLine("Type in an integer:");
input = Console.ReadLine();
intTest = int.Parse(input);
Console.WriteLine("Type in a decimal:");
input = Console.ReadLine();
floatTest = float.Parse(input);
Console.WriteLine("int: {0} float: {1}", intTest, floatTest);
}
}
The runtime error is:
Quote
Type in an integer:
Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
Parameter name: s
at System.Int32.Parse (System.String s) [0x00000]
at InputIntro.Main () [0x0001e] in /Users/Home/Desktop/InputIntro.cs:13
The application was terminated by a signal: SIGHUP
Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
Parameter name: s
at System.Int32.Parse (System.String s) [0x00000]
at InputIntro.Main () [0x0001e] in /Users/Home/Desktop/InputIntro.cs:13
The application was terminated by a signal: SIGHUP
Thanks


Sign In
Create Account


Back to top









