Está en la página 1de 6

#include <iostream>

#include <conio.h>
#include <stdlib.h>
#include <math.h>
#define pi=3.1415

using namespace std;


int main()
{
char oper;
do
{
cout<<"Menu Principal"<<endl;
cout<<endl;
cout<<"Operaciones ... O"<<endl;
cout<<endl;
cout<<"Series ....... S"<<endl;
cout<<endl;
cout<<"Areas ........ A"<<endl;
cout<<endl;
cout<<" FIN ... F"<<endl;
cin>>oper;
system("cls");

if(oper=='O') //operaciones
{
int oper1;
float res,op1,op2;
do
{
cout<<"Operaciones"<<endl;
cout<<endl;
cout<<"Suma ............ 1"<<endl;
cout<<endl;
cout<<"Resta ........... 2"<<endl;
cout<<endl;
cout<<"Multiplicacion .. 3"<<endl;
cout<<endl;
cout<<"Division......... 4"<<endl;
cout<<endl;
cout<<" Regresar .. 5"<<endl;
cout<<endl;
cin>>oper1;
system("cls");

if(oper1==1) //suma
{
cout<<"Ingrese un munero: ";
cin>>op1;
cout<<endl;
cout<<"Ingrese otro munero: ";
cin>>op2;
cout<<endl;
res=op1+op2;
cout<<"la suma de "<<op1<<" con "<<op2<<" es:
"<<res<<endl;
system("pause");
system("cls");
}

if(oper1==2) //resta
{
cout<<"Ingrese un munero: ";
cin>>op1;
cout<<endl;
cout<<"Ingrese otro munero: ";
cin>>op2;
cout<<endl;
res=op1-op2;
cout<<"la diferencia entre "<<op1<<" y "<<op2<<" es:
"<<res<<endl;
system("pause");
system("cls");
}

if(oper1==3) //multiplicacion
{
cout<<"Ingrese un munero: ";
cin>>op1;
cout<<endl;
cout<<"Ingrese otro munero: ";
cin>>op2;
cout<<endl;
res=op1*op2;
cout<<"el producto de "<<op1<<" por "<<op2<<" es:
"<<res<<endl;
system("pause");
system("cls");
}

if(oper1==4) //division
{
cout<<"Ingrese un munero: ";
cin>>op1;
cout<<"Ingrese otro munero: ";
cin>>op2;
cout<<endl;
res=op1/op2;
cout<<"el cosiente entre "<<op1<<" y "<<op2<<" es:
"<<res<<endl;
system("pause");
system("cls");
}
}
while(oper1!=5);
system("cls");
}
if(oper=='S') //series
{
char oper2;
do
{
cout<<endl;
cout<<"Series"<<endl;
cout<<endl;
cout<<"Fibonacci .....f"<<endl;
cout<<endl;
cout<<"Naturales .... n"<<endl;
cout<<endl;
cout<<"Cuadrados .... c"<<endl;
cout<<endl;
cout<<" Regresar .. r"<<endl;
cin>>oper2;
cout<<endl;
system("cls");

if(oper2=='f') //Fibonacci
{
int anterior,actual,n;
cout<<"ingrese el numero de terminos: "<<endl;
cin>>n;
anterior=0;
actual=1;
for(int i=0;i<n;i++)
{
if(i==0)
{
cout<<"0; ";
continue;
}
if(i==1)
{
cout<<"1; ";
continue;
}
int f=anterior+actual;
anterior=actual;
actual=f;
cout<<f<<"; ";
}
cout<<endl;
system("pause");
system("cls");
}

if(oper2=='n') //Naturales
{
int n;
//int a1,an,r;
//cout<<"ingrese el primer termino: ";
//cin>>a1;
//cout<<endl;
//cout<<"ingrese la razon: ";
//cin>>r;
//cout<<endl;
cout<<"ingrese el numero de terminos: ";
cin>>n;
cout<<endl;
//int p=1;
for(int i=1;i<=n;i++)
{
//an=a1+(p-1)*r;
//p=p+1;
//cout<<an<<"; ";
cout<<i<<"; ";
}
//int sn=a1*n+((n-1)*n*r)/2;
//cout<<"la suma es: "<<sn<<endl;
cout<<endl;
system("pause");
system("cls");
}

if(oper2=='c') //Cuadrados
{
int n,p;
cout<<"ingrese el numero de terminos: ";
cin>>n;
cout<<endl;
p=1;
for(int i=1;i<=n;i++)
{
cout<<p*p<<"; ";
p=p+1;
}
cout<<endl;
system("pause");
system("cls");
}
}while(oper2!='r');
system("cls");
}

if(oper=='A') //areas
{
char oper3;
do
{
cout<<"Areas"<<endl;
cout<<"triangulo ..... t"<<endl;
cout<<endl;
cout<<"cuadrado ...... c"<<endl;
cout<<endl;
cout<<"cubo .......... b"<<endl;
cout<<endl;
cout<<" regresar .. r"<<endl;
cin>>oper3;
cout<<endl;
system("cls");

if(oper3=='t') //triangulo
{
int a,b,c;
bool bien;
bien=false;
do
{
cout<<"ingrese los lados del triangulo: "<<endl;
cout<<endl;
cin>>a>>b>>c;
cout<<endl;

if((a>0)&&(b>0)&&(c>0))
{
bien=true;
}
else
{
cout<<"datos incorrectos"<<endl;
cout<<endl;
}
}while(bien==false);
if((b-c<a)&&(b+c>a)&&(a-c<b)&&(a+c>b)&&(a-
b<c)&&(a+b>c))
{
float sp=(a+b+c)/2; //semiperimetro
double area=sqrt(sp*(sp-a)*(sp-b)*(sp-c));
cout<<"el area es: "<<area<<endl;
cout<<endl;
}
else
{
cout<<"el triangulo no existe"<<endl;
}
system("pause");
system("cls");
}

if(oper3=='c') //cuadrado
{
int a;
cout<<"ingrese el lado del cuadrado: ";
cin>>a;
if(a>0)
{
float area;
area=a*a;
cout<<"el area es: "<<area<<endl;
cout<<endl;
}
if(a<=0)
{
cout<<"dato incorrecto"<<endl;
}
system("pause");
system("cls");
}

if(oper3=='b') // cubo
{
int a;
cout<<"ingrese el lado del cubo: ";
cin>>a;
if(a>0)
{
float area;
area=a*a*a;
cout<<"el area de la superficie es: "<<area<<endl;
cout<<endl;
system("pause");
system("cls");
}
if(a<=0)
{
cout<<"dato incorrecto"<<endl;
}
}
}while(oper3!='r');
system("cls");
}
}while(oper!='F'); //salir

system("cls");
cout<<endl;
cout<<endl;
cout<<endl;
cout<<" "<<endl;
cout<<" By Aglabe "<<endl;
cout<<" "<<endl;
return 0;
}

También podría gustarte