viernes, 5 de octubre de 2012

Menu Operciones

MENÚ    OPERACIONES 


CÓDIGO  PSEINT

Proceso suma
Acum1<-0;   
Acum2<-0;
Acum3<-1;
i<-0;  
j<-0;
k<-0;
Escribir "PROGRAMA OPCIONES";
Escribir "ESCOGA UNA OPCION";
Escribir "1. Serie";
Escribir "2. Suma Pares";
Escribir "3. Suma Impares";
Leer op;
Segun op Hacer
1:
Escribir "?Cuantos numeros";
Leer N;
Escribir "secuencia";
leer S;
Repetir
Acum1<-Acum1+S;
escribir sin saltar Acum1 ,"  ";
Suma<-Suma+Acum1;
i<-i+1;
Hasta Que i=N
Escribir " "
Escribir "la suma es ",Suma;
2:
Escribir "?Cuantos numeros";
Leer N;
Repetir
Acum2<-Acum2+2;
escribir sin saltar Acum2 ,"  ";
Suma<-Suma+Acum2;
j<-j+1;
Hasta Que j=N
Escribir "la suma es ",Suma;
3:
Escribir "?Cuantos numeros";
Leer N;
Repetir
Acum3<-Acum3+2;
escribir sin saltar Acum3 ,"  ";
Suma<-Suma+Acum3;
j<-j+1;
Hasta Que j=N
Escribir "la suma es ",Suma;
De Otro Modo:
Escribir "Opción inválida";
FinSegun
FinProceso




CÓDIGO  C++


#include<iostream>
using namespace std;

int main() {

float acum1;
float acum2;
float acum3;
float i;
float j;
float k;
float n;
float op;
float s;
float suma;

acum1=0;
acum2=0;
acum3=1;
i=0;
j=0;
k=0;
cout<<"PROGRAMA OPCIONES"<<endl;
cout<<"ESCOGA UNA OPCION"<<endl;
cout<<"1. Serie"<<endl;
cout<<"2. Suma Pares"<<endl;
cout<<"3. Suma Impares"<<endl;
cin>>op;
switch (int(op)) {
case 1:
cout<<"?Cuantos numeros"<<endl;
cin>>n;
cout<<"secuencia"<<endl;
cin>>s;
do {
acum1=acum1+s;
cout<<acum1<<"  ";
suma=suma+acum1;
i=i+1;
} while (i!=n);
cout<<" "<<endl;
cout<<"la suma es "<<suma<<endl;
break;
case 2:
cout<<"?Cuantos numeros"<<endl;
cin>>n;
do {
acum2=acum2+2;
cout<<acum2<<"  ";
suma=suma+acum2;
j=j+1;
} while (j!=n);
cout<<"la suma es "<<suma<<endl;
break;
case 3:
cout<<"?Cuantos numeros"<<endl;
cin>>n;
do {
acum3=acum3+2;
cout<<acum3<<"  ";
suma=suma+acum3;
j=j+1;
} while (j!=n);
cout<<"la suma es "<<suma<<endl;
break;
default:
cout<<"Opción inválida"<<endl;
break;
}

return 0;

}


 CODIGO VISUAL BASIC

Dim a, b, c As Integer
Private Sub Command1_Click()
Select Case a
Case Is = 1
     List1.Clear
     X = Val(Text2.Text)
     Y = 0
    Z = 0
        For i = 1 To Val(Text1.Text)
        Y = Y + X
        Z = Z + Y
        List1.AddItem (Z)
    Next i
    List1.AddItem ("TOTAL:" & Z)
Case Is = 2
        List1.Clear
    X = 2
    Y = 0
    Z = 0
   
    For i = 1 To Val(Text1.Text)
        Y = Y + X
        Z = Z + Y
        List1.AddItem (Z)
    Next i
    List1.AddItem ("TOTAL:" & Z)

Case Is = 3

        List1.Clear
   X = 1
   Y = 0
   Z = 0
   
    For i = 1 To Val(Text1.Text)
    Y = Y + X
        Z = Z + Y
       List1.AddItem (Y)
        X = 2
    Next i
     List1.AddItem ("TOTAL:" & Y)
End Select
End Sub

Private Sub Command2_Click()
Text1 = ""
Text2 = ""
List1 = ""


End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Form_Load()


Label1.Visible = False
Label2.Visible = False
Text1.Visible = False
Text2.Visible = False

End Sub

Private Sub Option1_Click()
a = 1
Label1.Visible = True
Label2.Visible = True
Text1.Visible = True
Text2.Visible = True
Label1.Caption = "INGRESE LA SERIE"
Label2.Caption = "VALOR A GENERAR"
End Sub

Private Sub Option2_Click()
a = 2
Label1.Visible = True
Label2.Visible = False
Text1.Visible = True
Text2.Visible = False
Label1.Caption = "SUMA PARES LIMITE"

End Sub

Private Sub Option3_Click()

a = 3
Label1.Visible = True
Label2.Visible = False
Text1.Visible = True
Text2.Visible = False
Label1.Caption = "SUMA IMPARES LIMITE"
End Sub




No hay comentarios:

Publicar un comentario