Treceți la conținutul principal

vc net calculator minimalist listing code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace calculator
{
    public partial class Form1 : Form
    {
        double x;
        char op;
        Color c;
        
        public Form1()
        {
            InitializeComponent();
        }

        private void b1_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "1";
        }

        private void b2_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "2";
        }

        private void b3_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "3";
        }

        private void b4_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "4";
        }

        private void b5_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "5";
        }

        private void b6_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "6";
        }

        private void b7_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "7";
        }

        private void b8_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "8";
        }

        private void b9_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "9";
        }

        private void b0_Click(object sender, EventArgs e)
        {
            tb1.Text = tb1.Text + "0";
        }

        private void bpz_Click(object sender, EventArgs e)
        {
            if(!tb1.Text.Contains('.'))
            tb1.Text = tb1.Text + ".";
        }

        private void bpm_Click(object sender, EventArgs e)
        {
            if (tb1.Text[0] == '-')
                tb1.Text = tb1.Text.Substring(1);
            else 
                tb1.Text = "-" + tb1.Text;
        }

        private void bp_Click(object sender, EventArgs e)
        {
            if (tb1.Text != "")
            {
                if (x == 0)
                {
                    x = double.Parse(tb1.Text);
                    op = '+';
                    tb1.Text = "";
                }
                else
                {
                    be_Click(sender, e);
                    tb1.Text = "";
                }
            }
        }

        private void bm_Click(object sender, EventArgs e)
        {
            if (tb1.Text != "")
            {
                x = double.Parse(tb1.Text);
                op = '-';
                tb1.Text = "";
            }
        }

        private void bo_Click(object sender, EventArgs e)
        {
            if (tb1.Text != "")
            {
                x = double.Parse(tb1.Text);
                op = '*';
                tb1.Text = "";
            }
        }

        private void bi_Click(object sender, EventArgs e)
        {
            if (tb1.Text != "")
            {
                x = double.Parse(tb1.Text);
                op = '/';
                tb1.Text = "";
            }
        }

        private void be_Click(object sender, EventArgs e)
        {
            double r=0;
            if(tb1.Text!="")
            {
                r=double.Parse(tb1.Text);
                if (op == '+') r = x + r;
                if (op == '-') r = x - r;
                if (op == '*') r = x * r;
                if (op == '/' && r!=0) r = x / r;
            }
            tb1.Text = r.ToString();
        }

        private void bc_Click(object sender, EventArgs e)
        {
            tb1.Text = "";
        }

        private void bbs_Click(object sender, EventArgs e)
        {
            if (tb1.Text!="") tb1.Text = tb1.Text.Substring(0, tb1.Text.Length - 1);
        }

        private void tb1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 46 && tb1.Text.Contains('.')) e.Handled = true;
            if ((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar!=46)
                e.Handled = true;
        }

        private void bc_MouseHover(object sender, EventArgs e)
        {
            c = bc.BackColor;
            bc.BackColor = Color.Red;
        }

        private void bc_MouseLeave(object sender, EventArgs e)
        {
            bc.BackColor = c;
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

Comentarii

Postări populare de pe acest blog

program principal cpp

#include "clasa.h" #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define DELAY 9000000 void delay() { for(long i=0;i<DELAY;i++); } //constructor cu initializare de la tastatura BigInt::BigInt() {char x; signed char t[400]; int i; printf("\nNumarul cu semn "); do s=getche(); while((s!='+')&&(s!='-')); n=0; do {x=getche(); t[n]=x-'0'; n++; } while((x>='0')&&(x<='9')); n--; for(i=0;i<n;i++) nr[i]=t[n-i-1]; } //constructor cu initializare prin parametri BigInt::BigInt(char semn,signed char numar[],int dim) {int i; s=semn; n=dim; for(i=0;i<n;i++) nr[i]=numar[n-i-1]; } //transform un int negativ in pozitiv int BigInt::Pozitiv(int x) {int a,vb; a=0; vb=0; while(vb==0) if((x+a)==0) vb=1; else a=a+1; x=a; return x; } //constructor dintr-un nr int obisnuit BigInt::BigInt(int x) {int i; if(x>=0) s='+'…

NUMERE PRIME ALGORITM C++

// NUMERE PRIME ALGORITM C++//  reediting from scratch //on this page is just the study for a next algoritm for generating the parime nr series like Fibonnaci or ....if possibile

74111121313417374414124343447 if u know the red part you can generate the orange part
1 0 1 111112222 1 1 23

o aplicatie php localitati romania

//APLICATIA SE REFERA LA BAZA DE DATE SIRUTA

//dragtable.js


/* dragtable v1.0 June 26, 2008 Dan Vanderkam, http://danvk.org/dragtable/ http://code.google.com/p/dragtable/ \Bsortabledraggable\B Instructions: - Download this file - Add <script src="dragtable.js"></script> to your HTML. - Add class="draggable" to any table you might like to reorder. - Drag the headers around to reorder them. This is code was based on: - Stuart Langridge's SortTable (kryogenix.org/code/browser/sorttable) - Mike Hall's draggable class (http://www.brainjar.com/dhtml/drag/) - A discussion of permuting table columns on comp.lang.javascript Licensed under the MIT license. */ // Here's the notice from Mike Hall's draggable script: //***************************************************************************** // Do not remove this notice. // // Copyright 2001 by Mike Hall. // See http…