01 de Julio, 2009 |
calculo de pi donde n numero es =infinito pi=-4/3+4/5..... |
Autor:
laloski, 20:29, guardado en
General |
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace pi { /// <summary> /// Descripción breve de Form1. /// </summary> public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Label ette; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label etres; private System.Windows.Forms.TextBox ctpi; private System.Windows.Forms.TextBox ctres; private System.Windows.Forms.Button btcal; private System.Windows.Forms.Button btlim; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.MenuItem menuItem1; private System.Windows.Forms.MenuItem menuItem2; private System.Windows.Forms.MenuItem menuItem3; private System.Windows.Forms.MenuItem menuItem4; private System.Windows.Forms.MenuItem menuItem5; /// <summary> /// Variable del diseñador requerida. /// </summary> private System.ComponentModel.Container components = null; public Form1() { // // Necesario para admitir el Diseñador de Windows Forms // InitializeComponent(); // // TODO: agregar código de constructor después de llamar a InitializeComponent // } /// <summary> /// Limpiar los recursos que se estén utilizando. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Código generado por el Diseñador de Windows Forms /// <summary> /// Método necesario para admitir el Diseñador. No se puede modificar /// el contenido del método con el editor de código. /// </summary> private void InitializeComponent() { this.ette = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.etres = new System.Windows.Forms.Label(); this.ctpi = new System.Windows.Forms.TextBox(); this.ctres = new System.Windows.Forms.TextBox(); this.btcal = new System.Windows.Forms.Button(); this.btlim = new System.Windows.Forms.Button(); this.mainMenu1 = new System.Windows.Forms.MainMenu(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem(); this.menuItem4 = new System.Windows.Forms.MenuItem(); this.menuItem5 = new System.Windows.Forms.MenuItem(); this.SuspendLayout(); // // ette // this.ette.Location = new System.Drawing.Point(120, 40); this.ette.Name = "ette"; this.ette.TabIndex = 0; this.ette.Text = "calcula pi"; // // label2 // this.label2.Location = new System.Drawing.Point(16, 112); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(136, 23); this.label2.TabIndex = 1; this.label2.Text = "donde lo quieres calcular"; // // etres // this.etres.Location = new System.Drawing.Point(16, 152); this.etres.Name = "etres"; this.etres.TabIndex = 2; this.etres.Text = "resultado"; // // ctpi // this.ctpi.Location = new System.Drawing.Point(176, 112); this.ctpi.Name = "ctpi"; this.ctpi.TabIndex = 3; this.ctpi.Text = "0"; this.ctpi.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.ctpi.TextChanged += new System.EventHandler(this.ctpi_TextChanged); // // ctres // this.ctres.Location = new System.Drawing.Point(176, 152); this.ctres.Name = "ctres"; this.ctres.ReadOnly = true; this.ctres.TabIndex = 4; this.ctres.Text = ""; this.ctres.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; // // btcal // this.btcal.Location = new System.Drawing.Point(32, 224); this.btcal.Name = "btcal"; this.btcal.TabIndex = 5; this.btcal.Text = "calcular"; this.btcal.Click += new System.EventHandler(this.btcal_Click); // // btlim // this.btlim.Location = new System.Drawing.Point(192, 224); this.btlim.Name = "btlim"; this.btlim.TabIndex = 6; this.btlim.Text = "limpiar"; this.btlim.Click += new System.EventHandler(this.btlim_Click); // // mainMenu1 // this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem1, this.menuItem4}); // // menuItem1 // this.menuItem1.Index = 0; this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem2, this.menuItem3}); this.menuItem1.Text = "opciones"; // // menuItem2 // this.menuItem2.Index = 0; this.menuItem2.Text = "-"; // // menuItem3 // this.menuItem3.Index = 1; this.menuItem3.Text = "salir"; this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click); // // menuItem4 // this.menuItem4.Index = 1; this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem5}); this.menuItem4.Text = "ayuda"; // // menuItem5 // this.menuItem5.Index = 0; this.menuItem5.Text = "acerca de"; this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(328, 270); this.Controls.Add(this.btlim); this.Controls.Add(this.btcal); this.Controls.Add(this.ctres); this.Controls.Add(this.ctpi); this.Controls.Add(this.etres); this.Controls.Add(this.label2); this.Controls.Add(this.ette); this.Menu = this.mainMenu1; this.Name = "Form1"; this.Text = "Form1"; this.ResumeLayout(false); } #endregion /// <summary> /// Punto de entrada principal de la aplicación. /// </summary> [STAThread] static void Main() { Application.Run(new Form1()); } private void btcal_Click(object sender, System.EventArgs e) { string dat; double a; double b=1; double pi1=0; double pi=4; double pi2=0; double c=(-1); double q; dat=ctpi.Text; a=double.Parse(dat); if(a==1) { pi=4; dat=Convert.ToString(pi); ctres.Text=dat;} else { if(a>1) { while(a!=b) { b=b+1; q=System.Math.Pow(c,(b-1)); pi2=4/(b+(b-1)); pi1=pi2*q; pi=pi+pi1; dat=Convert.ToString(pi); ctres.Text=dat;} } } } private void btlim_Click(object sender, System.EventArgs e) { ctres.Text=""; ctpi.Text=""; } private void menuItem5_Click(object sender, System.EventArgs e) { MessageBox.Show("Tu edad. VERSION 1.0" + Environment.NewLine + "COPYRIGTH (C)" + Environment.NewLine + "Luis Eduado Bautista Rosale,2009","asiendo lo de nadie", MessageBoxButtons.OK ,MessageBoxIcon.Information); } private void menuItem3_Click(object sender, System.EventArgs e) { Close(); } private void ctpi_TextChanged(object sender, System.EventArgs e) { } } }
|
|
Sin comentarios
· Recomendar |
 |
|
Al margen |
¡welcome a my disqBlog! |
Te doy la bienvenida a my spacio en Internet. Puedes publicar tus comentarios si lo deseas.
Disfrútalo!! Saludos |
| | |
Sobre mí |
Luis Eduardo Bautista R
SKATE COMPU Y ALGO MAS...
»
Ver perfil
|
|
|
Calendario |
 |
Marzo 2025 |
 |
|
DO | LU | MA | MI | JU | VI | SA | | | | | | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
|
|
| | |
|