cp/m Posted December 31, 2009 Report Posted December 31, 2009 Visual C# 2008 - CalculatorSoundtrack: BoneyM - RaspoutinYouTube - Visual C# - Calculatorusing 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_for_Youtube{ public partial class Form1 : Form { // Declaram variabile global ca sa nu trebuiasca sa la declaram in fiecare //functie double num1; double num2; double sum; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) {//num1 ia valoarea din primul textbox num1 = double.Parse(textBox1.Text); //num2 ia valoarea din al doilea textbox num2 = double.Parse(textBox2.Text); //sum ia valoarea sumei num1+num2 sum = num1 + num2; //punem sum in label1, insa mai intai trebuie sa trecem sum din double in string label1.Text = sum.ToString(); } private void button2_Click(object sender, EventArgs e) {//same thing dar cu "-" num1 = double.Parse(textBox1.Text); num2 = double.Parse(textBox2.Text); sum = num1 - num2; label1.Text = sum.ToString(); } private void button3_Click(object sender, EventArgs e) {//same thing dar cu "*" num1 = double.Parse(textBox1.Text); num2 = double.Parse(textBox2.Text); sum = num1 * num2; label1.Text = sum.ToString(); } private void button4_Click(object sender, EventArgs e) {//same thing dar cu "/" num1 = double.Parse(textBox1.Text); num2 = double.Parse(textBox2.Text); sum = num1 / num2; label1.Text = sum.ToString(); } }} Quote
CyberWolf08 Posted December 31, 2009 Report Posted December 31, 2009 Foarte frumos tutorialu dar mai bine pui la controale nume care sa reprezinte ce sunt(adica button1=SumBtn...) . S-ar intelege mai bine Quote
cp/m Posted December 31, 2009 Author Report Posted December 31, 2009 Multumesc. Nu le-am modificat, pentru ca atunci ar fi fost mai greu pentru un incepator sa schimbe numele alea. Quote
SympleBoy22 Posted December 31, 2009 Report Posted December 31, 2009 Foarte bun tutorialul si muzica. Quote
alien Posted January 1, 2010 Report Posted January 1, 2010 Imi place muzica si faptul ca mai exista persoane care mai si programeaza ceva aici. Oricat de mic ar fi programul.@cp/m: hint incearca sa folosesti Double.TryParse ca sa nu-ti crape programul daca introduci un string in loc de numar Poti sa-l introduci si intr-un try/catch pentru tratarea exceptiilor. Quote
cp/m Posted January 1, 2010 Author Report Posted January 1, 2010 Ok. Eu sunt incepator in C#. Insa stiu ceva Java care e asemanator. Eu in general folosesc perl si asm. Quote
CyberWolf08 Posted January 1, 2010 Report Posted January 1, 2010 Mai bine ai face niste tutoriale de asm... tot asa pentru incepatori Quote
SENEQ_o Posted January 11, 2010 Report Posted January 11, 2010 foarte bun tutorialul , intelege orice script kiddie Quote