#include<iostream>
using namespace std;
int main()
{
int a=0,b=0,c=0;
cout<<"ingrese un numero: ";cin>>a;
cout<<"ingrese otro numero: ";cin>>b;
while(a<=b)
{
if(a%2!=0)
c=c+1; a=a+1;
}
cout<<c<<endl;
cin.ignore(); return 0;
}
ejecutable
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication11
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text=textBox1.Text+'1';
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + '2';
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + '3';
}
private void button4_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + '4';
}
private void button5_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + '5';
}
private void button6_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + '6';
}
private void button7_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + '7';
}
private void button8_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + '8';
}
private void button9_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + '9';
}
private void button10_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + '0';
}
private void button11_Click(object sender, EventArgs e)
{
textBox1.Text = " ";
label4.Visible = false;
label5.Visible = false;
label6.Visible = false;
label7.Visible = false;
label8.Visible = false;
label9.Visible = false;
label10.Visible = false;
textBox2.Visible = false;
textBox3.Visible = false;
textBox4.Visible = false;
textBox5.Visible = false;
textBox6.Visible = false;
textBox7.Visible = false;
textBox8.Visible = false;
button12.Visible = true;
}
private void button13_Click(object sender, EventArgs e)
{
Close();
}
private void button12_Click(object sender, EventArgs e)
{
label4.Visible = true;
label5.Visible = true;
label6.Visible = true;
label7.Visible = true;
label8.Visible = true;
label9.Visible = true;
label10.Visible = true;
textBox2.Visible=true;
textBox3.Visible = true;
textBox4.Visible = true;
textBox5.Visible = true;
textBox6.Visible = true;
textBox7.Visible = true;
textBox8.Visible = true;
int i, j, dividendo;
int[,] billetes = new int[2, 7] {{1000,500,200,100,50,20,1},{0,0,0,0,0,0,0} }; ;
j = 0;
dividendo = Convert.ToInt16(textBox1.Text);
for (i = 0; i <= 6; i++) {
billetes[1, i] = dividendo / billetes[0, j];
dividendo = dividendo % billetes[0, j];
j++;
button12.Visible = false;
// MessageBox.Show(j.ToString());
}
textBox2.Text = Convert.ToString(billetes[1, 0]);
textBox3.Text = Convert.ToString(billetes[1, 1]);
textBox4.Text = Convert.ToString(billetes[1, 2]);
textBox5.Text = Convert.ToString(billetes[1, 3]);
textBox6.Text = Convert.ToString(billetes[1, 4]);
textBox7.Text = Convert.ToString(billetes[1, 5]);
textBox8.Text = Convert.ToString(billetes[1, 6]);
}
}
}
Clases
mapas mentales
programa cuadro mágico librería math
videos
El siguiente video está en inglés, pero se entiende
una tabla de multiplicar
formato moneda
private void pictureBox1_Click(object sender, EventArgs e)
{
for (int i = 28; i < 500;i++ )
{
pictureBox1.Location= new Point(i,34);
}
for (int i = 34; i < 200; i++)
{
pictureBox1.Location = new Point(500, i);
}
for (int i = 500; i > 28; i--)
{
pictureBox1.Location = new Point(i, 200);
}
for (int i = 200; i > 34; i--)
{
pictureBox1.Location = new Point(28, i);
}
}
dibuja línea
System.Drawing.Pen myPen;
myPen = new System.Drawing.Pen(System.Drawing.Color.Red);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.DrawLine(myPen, 0, 0, 200, 200);
myPen.Dispose();
formGraphics.Dispose();
varias formas
{
System.Drawing.Pen myPen;
myPen = new System.Drawing.Pen(System.Drawing.Color.Red);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.DrawLine(myPen, 0, 0, 200, 200);
formGraphics.DrawLine(myPen, 1, 1, 45, 65);
formGraphics.DrawBezier(myPen, 15, 15, 30, 30, 45, 30, 87, 20);
formGraphics.DrawEllipse(myPen, new Rectangle(33, 45, 40, 50));
formGraphics.DrawPolygon(myPen, new PointF[] {new PointF(1, 1),
new PointF (20, 10), new PointF(5, 4), new PointF(100, 2),
new PointF(200, 50), new PointF(39, 45)});
myPen.Dispose();
formGraphics.Dispose();
}
dibuja rectángulo con distinto grosor
System.Drawing.Pen myPen;
myPen = new System.Drawing.Pen(System.Drawing.Color.Green,3);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.DrawLine(myPen, 10, 10, 100, 10);
formGraphics.DrawLine(myPen, 10, 200, 100, 200); // (columna, renglón)
formGraphics.DrawLine(myPen, 10, 10, 10, 200);
formGraphics.DrawLine(myPen, 100, 10, 100, 200);
myPen.Dispose();
formGraphics.Dispose();
polígono construido con líneas
{
System.Drawing.Pen myPen;
myPen = new System.Drawing.Pen(System.Drawing.Color.Blue,2);
System.Drawing.Graphics formGraphics = this.CreateGraphics();
formGraphics.DrawPolygon(myPen, new PointF[] {new PointF(10, 10),
new PointF (100, 10), new PointF(10,10), new PointF(10, 200),
new PointF(10, 200), new PointF(100, 200), new PointF(100, 10), new PointF(100, 200)});
myPen.Dispose();
formGraphics.Dispose();
}


http://curso-mcts.blogspot.mx/2011/04/ejemplos-graficos.html
ResponderEliminarmás referencias para dibujar:
ResponderEliminarhttps://books.google.com.mx/books?id=xRlCQ17wzacC&pg=PA467&lpg=PA467&dq=drawpie+c%23&source=bl&ots=8fHgSjicnx&sig=STThwGvt3rAK3zHnyVcnWnuwyIg&hl=es&sa=X&ved=0ahUKEwit5YvkycLPAhUo2IMKHYbECf04ChDoAQg9MAQ#v=onepage&q=drawpie%20c%23&f=false
http://www2.uacj.mx/Publicaciones/GeneracionImagenes/imagenesCap1.pdf
ResponderEliminar