Intro #5-2:

CSharp · Console

/Program.cs

// Directions: Practice #5-2
// 1) Run the following code to see the error.
// 2) Add a try catch structure with an Exception ex in the parenthesis to keep the application from crashing.  
// 3) If an error occurs, Console should say the the following : "Error: Input string was not in a correct format.", WHILE USING ex.Message.
// 4) Do not change lines 12 through 15.
// 5) Submit your dotnetfiddle link in Blackboard.
using System;
					
public class Program
{
	public static void Main()
	{
		float fltHP = 0;
		string strHP = "";
		fltHP = float.Parse(strHP);
		Console.WriteLine("Value: " + fltHP);
	}
}
;