Advertisement
Guest User

Untitled

a guest
Apr 25th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. /*
  2.  * Created by SharpDevelop.
  3.  * User: MegaTron
  4.  * Date: 3/24/2015
  5.  * Time: 12:08 PM
  6.  *
  7.  * To change this template use Tools | Options | Coding | Edit Standard Headers.
  8.  */
  9. using System;
  10.  
  11. namespace proyecto002
  12. {
  13.     class Program
  14.     {
  15.         public static void Main(string[] args)
  16.         {
  17.             Console.WriteLine("Hello World!");
  18.            
  19.             // TODO: Implement Functionality Here
  20.             string nombre;
  21.             int numero;
  22.             Console.Write("Press any key to continue . . . ");
  23.             Console.ReadKey(true);
  24.            
  25.            
  26.             try
  27.             {
  28.                 Console.Write("Escriba su nombre ");
  29.                 nombre=Console.ReadLine();
  30.                
  31.                 Console.WriteLine("Escriba un numero ");
  32.                 numero=Convert.ToInt32(Console.ReadLine());
  33.                
  34.                 if ( nombre.Equals("") == true)
  35.                 {
  36.                     throw new ArgumentException("No puede tener una cadena vacia ");
  37.                 }
  38.             }
  39.             catch ( ArgumentException ex )
  40.             {
  41.                 Console.Write(ex.Message);
  42.             }
  43.             catch ( FormatException fe)
  44.             {
  45.                 Console.Write(fe.Message);
  46.             }
  47.            
  48.             Console.ReadKey(true);
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement