Program argument input values : Command Line : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Command Line »

 

Program argument input values








    


using System;

public class PassArguments {
  public static void Main(String[] args) {
    double  hotC, coldC;
    double  hotF, coldF; 
    if (args.Length != 2) {
      Console.WriteLine ("Enter a hot and a cold temerature as program arguments.");
      return;
    }       
    hotC = double.Parse(args[0]); 
    hotF = 9.0*hotC/5.0 + 32.0;  
    Console.WriteLine ("The Fahrenheit temperature is: {0:F1}", hotF);
    coldC = double.Parse(args[1]); 
    coldF = 9.0*coldC/5.0 + 32.0;
    Console.WriteLine ("The Fahrenheit temperature is: {0:F1}", coldF);
  }
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Command Line