Tabla dinamica PHP

Este es el codigo html para crear una tabla dinamica. La Parte de arriba pertenece a la apariencia html, el codigo que se encuentra entre las etiquetas <?php   ?> es la parte del codigo que hara que cuando insertemos valores en las casilla filas y colunnas estos se conviertan en una tabla con las dimensiones dadas. Para crear una tabla dinamica en PHP debemos escribir el siguiente codigo en el Body del html:


<body bgcolor="#FFFFFF">

<table align="center" bgcolor="#F1F1F1">
<tr>
<td colspan="2" align="center">Tabla Dinamica</td>
</tr>

<form method="post" enctype="text/multipart">
<tr>
<td>Filas:</td>
<td> <input type="text" name="f"> </td>
</tr>

<tr>
<td>Colunnas:</td>
<td><input type="text" name="c"> </td>
</tr>

<tr>
<td><input type="submit" value="Aceptar"> </td>
</tr>

<tr>
<td><input type="submit" value="Limpiar"> </td>
</tr>

</table>

</form>

&nbsp;



//Este es el codigo que creara la tabla
 
<table border=1 align="center">

<?php

$filas=$_POST['f'];
$a=0;
while($a < $filas){
echo "<tr>
</tr>";
$a++;


$colunnas=$_POST['c'];
$b=0;
while($b < $colunnas){
echo "<td>colunnas</td>";
$b++;

}
 }
?>



//Esta parte es para el boton limpiar

<?php
$filas=$_POST['0'];
$colunnas=$_POST['0'];
?>

</table>

</body>




Ejemplo: Si insertamos 2 en la casilla filas y 2 en la de colunnas aparecera una tabla como la siguiente:



Promedio de 5 valores en Lenguaje C

#include <stdio.h>
main()
{
float a,b,c,d,e,f,g;
printf("Primer valor ");
scanf("%f",&a);
printf("Segundo valor ");
scanf("%f",&b);
printf("Tercero valor ");
scanf("%f",&c);
printf("Cuarto valor ");
scanf("%f",&d);
printf("Quinto valor ");
scanf("%f",&e);
f=a+b+c+d+e;
g=f/5;
printf("\nLa suma es %f",f);
printf("\nEl promedio es %f",g);
}

Conversion de temperaturas en Lenguaje C

Con este codigo aparecera un menu con las opciones de la conversion que se desee hacer. Dechare las variables Float para que muestre los decimales.


#include  <stdio.h>
#include <conio.h>
 main()
 {
 float a,c,k,f,r,cc;
printf("1= celcius a kelvin\n");
printf("2= farentheit a rankine\n");
printf("3= farentheit a celcius\n");
printf("4= celcius a farenheit\n");
scanf("%f",&a);
if (a==1){
scanf("%f",&c);
k=273 + c;
printf("Temperatura de C a K:%f\n",k);
}
else if (a==2){
scanf("%f",&f);
r=460 + f;
printf("Temperatura de F a R:%f\n",r);
}

else if (a==3){
scanf("%f",&f);
c= f-32;
cc=c/1.8;
printf("Temperatura de F a C:%f\n",cc);
}

else if (a==4){
scanf("%f",&c);
f=1.8*c+32;
printf("Temperatura de C a F:%f\n",f);
}

}

Programa que habla VB 2008

Como hacer que Visual Basic.net hable 


Lo primero que tenemos que hacer es insertar 1 textbox y 1 button a un formulario.
Luego insertar el siguiente codigo en el botton:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim sapi
        sapi = CreateObject("sapi.spvoice")
        sapi.speak(TextBox1.Text)


    End Sub
End Class

Promedio / Media de tres notas VB 2008

Programa hecho en Visual Basic 2008 Express Edition que al insertar 3 notas calculara el promedio de estas. Recuerde que Promedio = x /N. Este programa tambien mostrara un mensaje en un label denominado lblcalificacion que dira como se califica el promedio de las notas insertadas.

Para hacer este programa necesitaras insertar en un formulario los siguientes objetos:

-6 Labels
-4 TextBoxs
-3 Bottons
-1 Shape en forma de rectangulo

Luego de insertar estos objetos escribir los siguientes codigos:


Public Class Form1
    Dim prom As Integer
    Dim promfinal As Integer
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        prom = Val(TextBox1.Text) + Val(TextBox2.Text) + Val(TextBox3.Text)

        promfinal = prom / 3
        Me.TextBox4.Text = promfinal

        If promfinal >= 0 And promfinal < 70 Then
            lblclasificacion.Text = "Promedio insuficiente"
        Else
            If promfinal > 69 And promfinal < 80 Then
                lblclasificacion.Text = "Promedio suficiente"
            Else
                If promfinal > 79 And promfinal < 90 Then
                    lblclasificacion.Text = "Buen promedio"
                Else
                    If promfinal > 89 And promfinal <= 100 Then
                        lblclasificacion.Text = "Promedio excelente"
                    End If
                End If
            End If
        End If


    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        lblclasificacion.Text = ""
        TextBox1.Select()

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.Close()
    End Sub
End Class

*En este programa se declararon dos variables (prom y promfinal) como Integer para que el resultado me de un numero entero.
*Botton1 = Boton Calcular
*Botton2 = Boton Limpiar
*Botton3 = Boton Cerrar

Calculadora aritmetica VISUAL BASIC 2008

Existen algunas diferencias entre la programacion en vb 6.0 y la programacion de vb 2008. Para hacer esta calculadora insertar dos 3 texbox, dos para insertar los valores y uno para que presente el resultado. Tambien se utilizaran 4 botton para hacer las 4 operaciones basicas. Y un boton final para limpiar los cuadros de texto. Para que la calculadora funcione escribir el siguiente codigo:



Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.TextBox3.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Me.TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.TextBox3.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        Me.TextBox3.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox1.Select()
    End Sub
End Class