You are on page 1of 5

#include <iostream>

#include <cmath>

using namespace std;

int f1(int n);


int f2(int N[10]);
void f3();
void f4();
void f5();
int f6(int f, int c,int M[10][10]);
void f7();

int M[10][10],opcion, bandera, bandera_2, n, i,j, i_2, V_1[10], V_2[10], N[10],


par, impar, negativo, positivo, mayor=0, menor=0, promedio, residuo, f,c;

int main()
{
do
{
cout<<"\n"
<<" .::: Menu de Opciones \" Vectores \" :::. "<<endl
<<"1) Cargar dos vectores de tamao N"<<endl
<<"2) Sumar los dos vectores en un tercer vector del mismo
tipo"<<endl
<<"3) Sumar los elementos impares y negativos del tercer
vector"<<endl
<<"4) Halla la posicion del mayor y menor elemento del tercer
vector"<<endl
<<"5) Calcular el promedio de los elementos negativos del
vector"<<endl
<<"6) Cargar una matriz de F filas y C columnas"<<endl
<<"7) Mostrar la Matriz ! "<<endl
<<"8) Sumar los elementos del perimetro de la matriz"<<endl
<<"9) Ordenar de menor a mayor los elementos del tercer
vector"<<endl<<endl;

cout<<"Enter >>";
cin>> opcion;
cout<<"___! "<<endl<<endl;
switch(opcion)
{
case 0: cout<<" Haz terminado el programa tio :( "
<<"\n\n";
system("pause");
break;

case 1:
cout<<"1) Cargar dos vectores de tamao N "<<endl
<<"Ingrese el tamao del vector 1 y 2 \n";
cin>> n;
f1(n);
break;

case 2:
f2(N);
break;

case 3:
f3();
break;

case 4:
f4();
break;

case 5:
f5();
break;

case 6:
cout<<"6) Cargar una matriz de F filas y C columnas"<<endl;
cout<<"Filas: ";
cin>>f;
cout<<"\n";
cout<<"Columnas: ";
cin>>c;
f6(f,c, M);
break;

case 7:
f7();
break;

default: cout<<" Oprime una opcion Valida !! :P "


<<"\n\n";
system("pause");
break;
}
}while(opcion!=0);
}

int f1(int n)
{

for (i=0;i<n;i++)
{
cout<<"V["<<i<<"]:";
cin>> V_1[i];
}
cout<<"Vector Cargado Tio ;)\n\n";
cout<<"Ingrese el Segundo Vector del mismo Tamao \n";
for (i_2=0;i_2<n;i_2++)
{
cout<<"V["<<i_2<<"]:";
cin>> V_2[i_2];
}
cout<<"Vectores Cargado Tio ;)\n\n";
bandera=1;
return(V_1[i],V_2[i_2]);
system("pause");
}
int f2(int N[10])
{
if (bandera==1)
{
cout<<"1) Sumar los dos vectores en un tercer Vector "<<endl<<endl;
for(i=0;i<n;i++)
{
N[i]= V_1 [i]+ V_2 [i];
cout<<"la suma de los dos vectores de N["<<i<<"]"<< N
[i]<<endl<<endl;
}
cout<<" El Vector esta cargado \n\n";
bandera_2=1;
}
else
{
cout<<" EL VECTOR NO ESTA CARGADO MI HERMANO \n";
}

return(N[10]);
system("pause");

void f3()
{
if (bandera_2==1)
{
cout<<"1) Sumar los elementos pares, impares, negativos y positivos del
tercer vector"<<endl<<endl;
for(i=0;i<n;i++)
{
if(N[i]%2==0)
{
par=par+N[i];
if(N[i]>0)
{
positivo=positivo+N[i];
}
else
{
negativo=negativo+N[i];
}
}
else
{
impar=impar+N[i];
if(N[i]>0)
{
positivo=positivo+N[i];
}
else
{
negativo=negativo+N[i];
}
}
}
cout<<" La suma de los elementos pares es: " << par<<endl
<<" La suma de los elementos impares es: " <<impar <<endl
<<" La suma de los elementos negativos es: " <<negativo<<endl
<<" La suma de los elementos positivos es: "
<<positivo<<endl<<endl;
}
else
{
cout<<" EL VECTOR NO ESTA CARGADO MI HERMANO \n";
}
system("pause");
}

void f4()
{
cout<<"4) Halla la posicion del mayor y menor elemento del tercer vector"<<endl;
if (bandera_2==1)
{
for(i=0;i<n;i++)
{

if(N[i]>N[mayor])
{
mayor=i;
menor=mayor;
}
else
{
mayor=mayor;
menor=i;
}
}
cout<<" La posicion del numero mayor es N[" << mayor<< "]"<<endl
<<" la posicion del numero menor es N[" << menor<< "]"<<endl;
}
else
{
cout<<" EL VECTOR NO ESTA CARGADO MI HERMANO \n";
}
system("pause");
}

void f5()
{
if (bandera_2==1)
{
cout<<"5) Calcular el promedio de los elementos negativos del vector"<<endl;
for(i=0;i<n;i++)
{
if(N[i]>0)
{
positivo=positivo+N[i];
}
else
{
negativo=negativo+N[i];
}
promedio=(negativo/n);
}
cout<<"El promedio de los numeros negativos es: "<<promedio<<" aproximadamente "
;
system("pause");
}else
{
cout<<" EL VECTOR NO EST CARGADO TIO \n\n";
}
system("pause");
}

int f6(int f, int c, int M[10][10])


{

for (i=0;i<f;i++)
{
for (j=0;j<c;j++)
{
cout<<"M["<<i<<"]["<<j<<"]:";
cin>> M[i][j];
}
}
cout<<" Matriz Cargada Tio \n\n";
return(M[10][10]);
system("pause");

void f7()
{
for(i=0;i<f;i++)
{
for(i=0;i<c;i++)
{
cout
}

You might also like