Advertisement
LightProgrammer000

Formulário Simples [Básico]

Dec 4th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.80 KB | None | 0 0
  1. // Biblioteca
  2. using System;
  3.  
  4. // Programa
  5. namespace EX_09
  6. {
  7.     // Classe
  8.     public class Program
  9.     {
  10.         // Método Principal
  11.         public static void Main(string[] args)
  12.         {
  13.             // Variáveis
  14.             string nom;
  15.             string end;
  16.             string tel;
  17.             string ano_atual;
  18.             int idade, ano_nasc;
  19.  
  20.             // Apresentação
  21.             Console.Clear();
  22.             Console.Write("\n ---------- FORMULARIO ---------- \n\n");
  23.  
  24.             // Nome
  25.             Console.Write(" - Digite Nome: ");
  26.             nom = Console.ReadLine();// String
  27.  
  28.             // Endereço
  29.             Console.Write(" - Digite Endereço: ");
  30.             end = Console.ReadLine();// String
  31.              
  32.             // Telefone
  33.             Console.Write(" - Digite Telefone: ");
  34.             tel = Console.ReadLine();// String
  35.  
  36.             // Ano de Nascimento
  37.             Console.Write(" - Digite Ano de Nascimento: ");
  38.             ano_nasc = Convert.ToInt32(Console.ReadLine());// Conversão INT <-- String
  39.  
  40.             // Captura do Ano Atual
  41.             ano_atual = DateTime.Now.ToString("yyyy");
  42.  
  43.             // Cálculo da Idade
  44.             idade = Convert.ToInt32(ano_atual) - ano_nasc;
  45.  
  46.             // Relatório
  47.             Console.Clear();
  48.             Console.WriteLine("\n ---------- RELATÓRIO ----------");
  49.             Console.WriteLine("\n - Nome: " + nom);
  50.             Console.WriteLine("\n - Endereço: " + end);
  51.             Console.WriteLine("\n - Telefone: " + tel);
  52.             Console.WriteLine("\n - Ano de Nascimento: " + ano_nasc);
  53.             Console.WriteLine("\n - Ano Atual: " + ano_atual);
  54.             Console.WriteLine("\n - Idade: " + idade);
  55.             Console.WriteLine(" ----------------------------- ");
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement